Skip to content

PDF Get Text (Page)

Type: pdf-get-text-page  ·  Package: PDF Activities v1.2.4  ·  Output: string

Extracts the text of one specific page of a PDF. Useful when the value you need is always on a given page (the first, the last), or to process the document page by page.

Returns the text of the page given in page (numbered from 1). It is the same text PDF Get Text gets for that page. It doesn’t modify the file.

ParameterTypeDefaultDescription
pathstring—Path of the PDF file.
pageint—Page number, starting at 1. Accepts a number or a text holding an integer ("3").

None.

Returns a string with the text of that page. If the page has no text layer (scanned), an empty text.

MessageCause and fix
'page' must be a positive integer. Received: ….page is 0, negative, a decimal or not a number.
Page … out of range. The document has … pages.You asked for a page beyond the total. Get the total first with PDF Get Page Count.
File not found.The path doesn’t exist.
'path' is required. / 'page' is required.The parameter was left empty or its expression returned null.
PDF library error when opening the filePassword-protected or damaged PDF. See Protected and damaged PDFs.

Go through every page reading each one:

PDF Get Page Count path = filePath → output: total
For Loop from = 1 to = total + 1 indexVariable = p
└─ activities:
PDF Get Text (Page) path = filePath page = p → output: pageText
... process the page ...

Read only the last page (where totals usually are):

PDF Get Page Count path = filePath → output: total
PDF Get Text (Page) path = filePath page = total → output: lastPage