PDF Get Page Count
PDF Get Page Count
Section titled “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.
How it works
Section titled “How it works”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.
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
path | string | — | Path of the PDF file. |
Optional parameters
Section titled “Optional parameters”None.
Output
Section titled “Output”Returns an int with the number of pages.
Common errors
Section titled “Common errors”| Message | Cause 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 file | Password-protected, damaged or not a PDF. See Protected and damaged PDFs. |
Example
Section titled “Example”PDF Get Page Count path = filePath → output: pagesIf condition = pages > 50 └─ then: Log level = warning message = "The document has " + pages + " pages"Related activities
Section titled “Related activities”- PDF Get Text (Page) — go through each page.
- PDF Get Metadata — more data about the document (it also includes
PageCount).