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

Free Support Forum - aspose.com

How to fix the page height automatically in Aspose Pdf

Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();
Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();
sec1.PageInfo.PageHeight = 4000;

I don't want to hardcoded the page height.

I just want it should be fixed automatically according to data or number of rows present in the pdf.

Hi Som,


Thanks for your inquiry. Currently by default page size is A4 and API moves contents automatically to next page when content size increase from page size. However currently to change page size you have to set page dimensions property manually.

As per my understanding you want to keep all contents on same page by increasing page size automatically. This feature is not supported at the moment. We have logged an investigation ticket as PDFNEWNET-37476 for further investigation and implementation. We will keep you updated about the issue resolution progress.

We are sorry for the inconvenience caused.

Best Regards,

Hi Som,


Adding more to Tilal’s comments, the following post might be useful if you need to Figure out if the table will break in current page.