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

Free Support Forum - aspose.com

Table needs more than one page

Dear experts,

I am inserting a table into an existing pdf document. But my table can need more than one page. How can this be implemented? Here is my code that does not take into account the need in multiple pages:

                    Page page = pdfDocument.Pages.Add();
                    TextFragment tableDescription = new TextFragment("Some table description")
                    {
                        Position = new Position(0, 0),
                    };
                    page.Paragraphs.Add(tableDescription);
                    page.Paragraphs.Add(productsTable);

Thanks!

@dpreznik

Thanks for contacting support.

As default behavior, the table flows to subsequent pages when it reaches Bottom margin of the page. However you can forcefully insert page break when certain number of rows are added for table. You may please check “Insert a Page Break Between Rows of The Table” article in our API documentation, in order to achieve your requirement.

In case you still face any issue, please share complete code snippet, which you are trying to add table in existing PDF along with sample PDF document. We will test the scenario in our environment and address it accordingly.

1 Like

Good Morning Ali,

Thank you for your answer.
Yes, the table works correctly. I have one more issue though. To make all fields read-only, I use the following code:

pdfDocument.Form.Flatten();

For some reason, not all fields become read-only, some stay editable. Could you please help?

Thanks.

EDITED:
Never mind, I figured it out. This flattens ALL fields:

pdfDocument.Flatten();

@dpreznik

Thanks for the acknowledgement.

It is good to know that your issue has been resolved. Please keep using our API and in case of any further assistance, please feel free to create a new topic. We will be happy to assist you accordingly.