easyPDF SDK Usermanual
PDF Creator Programming API  |  Download Free Trial  |  Contact Us to Purchase

GetPageCount Method

Gets page count from a PDF file.

Function GetPageCount() As Long

int GetPageCount()

int GetPageCount() throws PDFProcessorException



Return Values

Page count of the input PDF file.


For those who are familiar with GetPageCount from the PDFProcessor object, note that this version of GetPageCount from the PDFProcessorHandle object does not take an optional password argument for working with encrypted PDF files. If and when PDFProcessorHandle is enhanced to support processing of encrypted PDF files, the password required will be taken by OpenFile or OpenMem at the time the PDFProcessorHandle is obtained.

Example Usage in VBScript

Set oProcessor = CreateObject("easyPDF.PDFProcessor.8")

Set oProcessorHandle = oProcessor.OpenFile("C:\test\input.pdf", "C:\test\input.pdf")

nCount = oProcessorHandle.GetPageCount()
MsgBox "There are " + CStr(nCount) + " pages in this PDF file"

Example Usage in VB.NET

Dim oProcessor As PDFProcessor = New PDFProcessor
Dim oProcessorHandle As PDFProcessorHandle = oProcessor.OpenFile("C:\test\input.pdf", "C:\test\input.pdf")
   Dim nCount As Long = oProcessorHandle.GetPageCount()
MessageBox.Show("There are " + nCount.ToString() + " pages in this PDF file")

Example Usage in C#

PDFProcessor oProcessor = new PDFProcessor();
PDFProcessorHandle oProcessorHandle = oProcessor.OpenFile(@"C:\test\input.pdf", @"C:\test\input.pdf", null);
   long nCount = oProcessorHandle.GetPageCount();
MessageBox.Show("There are " + nCount.ToString() + " pages in this PDF file");