Get the number of pages.
int pdfGetNumPages(PDFViewerHandle viewer)
This function returns the number of pages in the currently open PDF file.

Internally, pages are numbered 1 to N, where N is the value returned by the pdfGetNumPages function, even if this doesn't match up with the document page numbering. For example, if a document has pages i-vii and 1-100, the PDF file will contain pages 1-107.

This function returns -1 if no PDF file is open.

int nPages; nPages = pdfGetNumPages(viewer);