We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

position datagrid on a page while exporting to pdf


i am trying to find a way to 
1. position datagrid in a specific part of the page
2. to fit it in this part.
3. how to prevent stretching of the datagrid with options.FitAllColumnsInOnePage = true

for instance, let's say we have page a4 splitted on 4 equal  parts with 1 vertical and 1 horizontal line
how can i output pdf to the rightmost part (right bottom corner )

and is there is some method to fit output in this part 



1 Reply

PK Pradeep Kumar Balakrishnan Syncfusion Team January 20, 2019 08:51 PM UTC

Hi Ilya, 
Thanks for contacting Syncfusion Support. 
We have checked your query and prepared a sample based on your requirement. You can download the same from the below link. 
Code Snippet: 
DataGridPdfExportOption dataGridPdfExportOption = new DataGridPdfExportOption(); 
//To Fit all the columns in one page. 
dataGridPdfExportOption.FitAllColumnsInOnePage = true; 
PdfDocument document = new PdfDocument(); 
//To Place the grid the grid where we want. 
document.PageSettings.SetMargins(250, 350,0,0); 
PdfGrid grid = new PdfGrid(); 
grid = pdfExport.ExportToPdfGrid(dataGrid, this.dataGrid.View, dataGridPdfExportOption, document); 
grid.Style.AllowHorizontalOverflow = false; 
PdfPage pdfPage = document.Pages.Add(); 
grid.Draw(pdfPage, new RectangleF(0, 0, 0, 0)); 
Also refer the below UG link for Pdf Document Customization. 
Please let us know if you need further assistance on this.  
Pradeep Kumar B 

Live Chat Icon For mobile
Up arrow icon