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

Free Support Forum - aspose.com

Table Inserted on earlier page breaks following page's layout

@simon.fairey

Thanks for writing back.

Would you kindly share an expected PDF document with us. We will try to generate alike PDF in our environment and share our findings with you.

Hi

The very first post in this thread shows a right and a wrong document. Right is generated by not including a table and wrong when you add the table on the page before.

Simon

@simon.fairey

We have tested the scenario again using your earlier shared documents. In your shared code snippet and documents, you were inserting new page at the start of input PDF and adding table to newly inserted page causing extra space at the top of second page. By investigating your code snippet, we found the code which was causing page to rotate and raising the issue.

Nevertheless, by removing the suggested lines of code, the output PDF document was as per expectations. However, shared PDF document and code snippet are quite simplified and not sufficient to understand your complete requirements and scenario which you are implementing at your end.

Just in case you want to insert a page with landscape orientation, you can specify its height and width as following:

Page pageTOC = newPdf.Pages.Insert(1);
pageTOC.PageInfo.Margin = new MarginInfo(20, 20, 20, 20);
pageTOC.PageInfo.Height = PageSize.A4.Width;
pageTOC.PageInfo.Width = PageSize.A4.Height;

Furthermore, if our understandings are not correct about your actual requirements or scenario, we request you to please share some more details. We will again test the scenario in our environment and address it accordingly.

Been very busy recently but this issue has caused another problem when trying to put a page stamp right aligned in the footer and it goes off the edge of the page if we include a table of content. I will update this with a suitable example in the next couple of days

@simon.fairey

Please take your time for sharing the code snippet able to reproduce the issue you are experiencing. We will test the scenario in our environment and address it accordingly.

Hi

Having done more testing it appears this is indeed the issue and that as long as I set the height and width the page is correctly oriented.

However for other peoples reference I believe there was also a change in the libs that helped this as previously with an older version of the libs it didn’t work without the landscape setting but with the latest it does so that’s great.

Thanks

@simon.fairey

Thanks for your kind feedback.

It is good to know that your issue has been resolved. Please keep using our API and in case of any further query, please feel free to create a new topic.