Articles in this section
Category / Section

How to preserve the entire PdfLightTable in one page?

1 min read

You can draw the PdfLightTable on a temporary page and get the height of the table. By using the table height, you can start a table on a new page when there is no more space on the first page. Refer to the following code example to draw the table:

C#

//Draw the Table in a temp page to find the Table height.
PdfDocument tempDoc = new PdfDocument();
//Add the page in a temporary document.
PdfPage tempPage = tempDoc.Pages.Add();
//Draw the table in a temporary page.
PdfLayoutResult result = tblPDF.Draw(tempPage, new PointF(), format);
//Get the height of the table and check for the condition if greater than room size say, 100.
if (result.Bounds.Height > 100)
{
//For table size greater than the room size(100), draw the table on the next page.
page = document.Pages.Add();
}
//Draw the table.
tblPDF.Draw(page, new PointF(), format);

Sample Link:

http://www.syncfusion.com/downloads/support/directtrac/general/PdfLightTable-1186642837.zip

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied