Detect how many pages?

I know I can use symbols to display page x of y, but is there a way to tell how many pages the PDF takes up?

We're generating invoices that may or may not have additional pages and want to show a footer on all pages, but only if there are more than one pages.

Hello Duane,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for considering Aspose.

Pdf class has a property named PageCount which returns an int value that indicates the total pages count of the generated PDF document. But, you can only get the value of this property when the Save method is called. I'm afraid it cannot return information until the PDF document is saved. We apologize for the inconvenience.

FYI, we've another product named Aspose.Pdf.Kit which offers the capability to manipulate/edit any existing PDF documents. Aspose.Pdf.Kit has a class named PdfFileInfo which contains a property named NumberOfPages that can used to get the total number of pages in a PDF file. Later on, AddFooter/AddHeader/AddPageNumber methods in PdfFileStamp class can be used to add the Header/Footer sections and page number information.