Is there a method to measure the size of a PdfGrid before I draw it to a page or can I set any properties to force the PdfGrid on one page?
I´m doing a complex layout so the content is variable. But I want the content of a specific PdfGrid not possibly allocated on two pages but only on one page. If there is not enough room left to fit it, a page break should be inserted.
Is there a way to archive this?
I found no way to measure the size of the PdfGrid before it is drawn and PdfGridLayoutFormat seems only to care for single rows, not for the whole PdfGrid. And besides it seems to remove sometimes Information of the grid.
PHPraveenkumar H Syncfusion Team November 13, 2014 12:14 PM UTC
Thank you for using Syncfusion
Essential Pdf doesn’t have any property to get PdfGrid table height, we
have created a workaround to get the solution. We have created
dummy PdfDcocument to get the height of the table.
refer following the code snippet.
the Table Height
PdfLayoutResult result = pdfGrid.Draw(page, new PointF(0, 0));
float height = result.Bounds.Height;
If the element exceeds the page,
pagination is used to proceed it on the next page. We can enable the
pagination by using the Pagination property available in the PdfLayoutType
enumeration. Please refer the following code snippet:
//Create the PdfGird
pdfGrid = newPdfGrid();
format = newPdfGridLayoutFormat();
the grid in to the page of the PDF document using that layoutformat
We have attached the sample for
your reference in below links