Skip to content

PDF Get Page Count

Type: pdf-get-page-count  ·  Package: PDF Activities v1.2.4  ·  Output: int

Returns the total number of pages of a PDF. Useful to go through the document page by page or to check it has the expected number of pages.

Opens the PDF for reading and returns how many pages it has. It works the same with scanned PDFs (no text layer needed). It doesn’t modify the file.

ParameterTypeDefaultDescription
pathstring—Path of the PDF file.

None.

Returns an int with the number of pages.

MessageCause and fix
File not found.The path doesn’t exist.
'path' is required.path was left empty or its expression returned null.
PDF library error when opening the filePassword-protected, damaged or not a PDF. See Protected and damaged PDFs.
PDF Get Page Count path = filePath → output: pages
If condition = pages > 50
└─ then:
Log level = warning message = "The document has " + pages + " pages"