BCL easyConverter SDK HTML
easyConverter SDK Usermanual
PDF-to-HTML Programming API  |  Download Free Trial  |  Contact Us to Purchase

NumberOfPages Property

Get the total number of pages from the input PDF.

int get_NumberOfPages(string InputFileName, string Password)
Function get_NumberOfPages(InputFileName As String, Password As String) As Integer
def getNumberOfPages(self, InputFileName, Password)
int getNumberOfPages(String InputFileName, String Password) throws PDF2HTMLException
function getNumberOfPages($InputFileName, $Password)
BclHthrError GetNumberOfPages(BclPDF2HTML * pPdf2Html,const wchar_t * InputFileName, const wchar_t * Password, int * pResult);
Function NumberOfPages(InputFileName As String, [Password] As Variant) As Long

Not applicable.

Parameters

InputFileName

Input PDF file.

Password (optional)

Password to open the PDF document, if any.

Exception Handling

Please refer to the list of return exceptions.

Example Usage

using BCL.easyConverter.HTML;
...
PDF2HTML pdf2html = new PDF2HTML();
try
{
   int numPages = pdf2html.get_NumberOfPages(@"c:\temp\input.pdf", "");
   Console.WriteLine(numPages);
}
catch(PDF2HTMLException ex)
{
   Console.WriteLine(ex.Message);
}
finally
{
   pdf2html.Dispose();
}
Imports BCL.easyConverter.HTML
...
Dim pdf2html As New PDF2HTML()
Dim numPages As Integer
Try
   numPages = pdf2html.get_NumberOfPages("c:\test\input.pdf", "")
   System.Console.WriteLine(numPages)
Catch ex As PDF2HTMLException
   System.Console.WriteLine(ex.Message)
Finally
   pdf2html.Dispose()
End Try
import PDF2HTML
pdf2html = PDF2HTML.PDF2HTML()
try:
   numPages = pdf2html.getNumberOfPages("c:\\test\\input.pdf", "")
   print(numPages)
except PDF2HTML.PDF2HTMLException as ex:
   print(ex)
PDF2HTML pdf2html = new PDF2HTML();
try
{
   int numPages = pdf2html.getNumberOfPages("c:\\temp\\input.pdf", "");
   System.out.println(numPages);
}
catch(PDF2HTMLException e)
{
   System.out.println(e);
}
finally
{
   pdf2html.dispose();
}
<?php
require("PDF2HTML.php");
$pdf2html = new BCL\easyConverter\HTML\PDF2HTML();
try
{
   $numPages = $pdf2html->getNumberOfPages("c:\\test\\input.pdf", "");
   echo "Number of pages: ", $numPages, "\n";
}
catch(BCL\easyConverter\HTML\PDF2HTMLException $ex)
{
   echo $ex->getMessage(), "\n";
}
?>
#include <stdio.h>
#include <windows.h>
#include "easyConverterHTML.h"

int main()
{
   HMODULE hPdf2HtmlDll = LoadLibraryW(L"C:\\Program Files\\BCL Technologies\\easyConverter SDK 5\\Html\\easyConverterHTML.dll");
   if(!hPdf2HtmlDll)
   {
      printf("easyConverter could not be loaded.\n");
      return 1;
   }
   else
   {
      int numPages = 0;
      BclWdhrError error;
      BclPDF2HTML* pPdf2Html = CreatePDF2HTML(hPdf2HtmlDll);
      if(!pPdf2Html)
      {
         printf("easyConverter could not be initialized.\n");
         FreeLibrary(hPdf2HtmlDll);
         return 1;
      }
      error = pPdf2Html->GetNumberOfPages(pPdf2Html, L"c:\\test\\input.pdf", L"", &numPages);
      if(error)
      {
         printf("Conversion failed with error %d.\n", error);
         FreeLibrary(hPdf2HtmlDll);
         return 1;
      }
      else
         printf("Number of pages: %d\n", numPages);
      pPdf2Html->Dispose(pPdf2Html);
      FreeLibrary(hPdf2HtmlDll);
      return 0;
   }
}
oConverter = CreateObject("EasyConverter.PDF2HTML.5")
nPages = oConverter.NumberOfPages(inFileName)

Not applicable.