Please enable JavaScript to view this site.

Navigation: Developer Information > Command Line Interface

Command Line PDF Page Count

Scroll Prev Top Next More

win2pdfd.exe pagecount "sourcefile"


Returns number of PDF pages from “sourcefile”. If the “sourcefile” file name contains spaces, it must be enclosed with quotation marks.  The "sourcefile" can be a local file path, or an web address (URL) to an existing PDF.


From the Windows CMD prompt, the page count can be referenced using the built-in %ERRORLEVEL% environment variable. This can be referenced from other Win2PDF command line options in a batch file.


From PowerShell, the page count can be referenced using $LASTEXITCODE.


Returns 0 if an error occurs.