We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose PDF - Table break to new page


I’m trying to generate PDF content dynamically. since the number of pages is unknown, created a new page and added 20 number of Tables to first page, like below.

Page dynamicPage = tempDocument.Pages[1];
table.IsBroken = true;
table.IsKeptWithNext = true;
table.IsInNewPage = false;
// tempDocument.ProcessParagraphs(); – tried no use
MemoryStream temp_outputStream = new MemoryStream();
tempDocument.Save(temp_outputStream); // throws error here

FYI: there are no illegal charcters in the document.

Please suggest, how to fix this.

and also is it possible to calculate the total tables height in a given pages, to check total tables height exceeds the page pureheight.



Thank you for contacting support.

I have observed the information shared by you but I have not been able to reproduce the issue. Moreover, the Subject of this thread addresses Table Break but the comment in your sample code mentions problem while saving the document. Please clarify your requirements and share with us a complete code sample to reproduce the issue in our environment, along with the generated file showing the table break issue. So that we may know how many rows and columns exist in each of the 20 tables you are adding to a page.

You can calculate the height of all the tables present on a specific page by using the below sample code on your end.

        double height = 0;
        TableAbsorber absorber = new TableAbsorber();
        foreach (AbsorbedTable tbl in absorber.TableList)
            height = height + tbl.Rectangle.Height;

PS: The table height property uses point as the basic unit, where 1 inch = 72 points and 1 cm = 1/2.54 inch = 0.3937 inch = 28.3 points.