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

Free Support Forum - aspose.com

Restrict number of pages

Is it possible to restrict the number of pages in a PDF document?

I am generating the PDF using API calls and occasionally, I only want a single page document, no matter if the content runs over into more than 1 page.


Hello Craig,

Thanks for considering Aspose.

The number of pages in a Pdf file, generated by Aspose.Pdf are based on the contents of the Pdf file and are auto generated. I am afraid you cannot restrict the page count, when the Pdf file is being generated

As a workaround, you can use Aspose.Pdf.Kit to extract the first page out of the generated Pdf file or convert the resultant Pdf into single page Pdf files. For more information please visit

FYI: Aspose.Pdf.Kit is a component which is used to manipulate/edit existing Pdf files.