Skip to content

Get Page Number Action: getPageNumber

The getPageNumber action is used to identify the page number of the first occurrence of a specified text within a PDF file. This is particularly helpful for locating content in large documents.

Example: You have a PDF file named Report.pdf and want to find the page number of the first occurrence of the text “Quarterly Revenue”.

Steps to Configure:

  1. Add a new step.
  2. Select SET from the Action dropdown.
  3. Enter a variable name in Element Key (e.g., PageNumber). This variable will store the page number of the text’s first occurrence.
  4. Click on Form, select Functions, and choose PDF File Handler Functions.
  5. In the action field, select getPageNumber and provide the following parameters:
    • fPath: Specify the path of the PDF file to be scanned (e.g., C:\Reports\Report.pdf).
    • text: Enter the text to search for in the PDF file (e.g., Quarterly Revenue).
  6. Click Save.
v7_pdf_file_handler_getPageNumber_list_view
List View
v7_pdf_file_handler_getPageNumber_grid_view
Grid View

Outcome on execution:

  • The action returns the page number of the first occurrence of the specified text in the variable defined in the Element Key.
  • If the text is not found, the variable remains empty or returns a specific error message.
  • This variable can be referenced in subsequent steps of the automation process using the syntax ${VariableName} (e.g., ${PageNumber}).
Important Notes:

  • The search is case-sensitive; verify the text input matches the text in the PDF.
  • Only the first occurrence of the text is returned; subsequent occurrences are ignored.

Last updated: Oct 6, 2025
Back To Top