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 a Variable Value 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 Cmd 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.
scrn-get-page-number-command-tabular-view
Tabular View
scrn-get-page-number-command-card-view
Card 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.

Back To Top