Skip to content

PDF Get Text

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

Extracts all the text of a PDF, joining the content of all its pages into a single string. It is the core activity to read documents: invoices, contracts, reports — and then extract specific values with regular expressions.

Reads the text of each page of the PDF, in order, and joins it, separating pages with separator (two line breaks by default). Returns the result as a string. It doesn’t modify the file.

The text comes out in the order the PDF stores its characters, which usually matches reading order but not always (columns, tables). If you need to know where each value is on the page, use PDF Get Words.

ParameterTypeDefaultDescription
pathstring—Path of the PDF file.
ParameterTypeDefaultDescription
separatorstring"\n\n"Text placed between one page and the next. Two line breaks by default.

Returns a string with all the text of the PDF. A scanned PDF (no text layer) returns an empty or almost empty text (just the separators), without failing.

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.

Extract the total and the number of an invoice:

PDF Get Text path = invoicePath → output: text
Set Variable name = number value = regexFind(text, "INV-\d+")
Set Variable name = total value = regexFind(text, "Total:\s*\$?([\d.,]+)")

Separate pages with your own marker to split the text afterwards:

PDF Get Text path = filePath separator = "\n---PAGE---\n" → output: text