PDF Get Text
PDF Get Text
Section titled “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.
How it works
Section titled “How it works”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.
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
path | string | — | Path of the PDF file. |
Optional parameters
Section titled “Optional parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
separator | string | "\n\n" | Text placed between one page and the next. Two line breaks by default. |
Output
Section titled “Output”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.
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”Extract the total and the number of an invoice:
PDF Get Text path = invoicePath → output: textSet 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: textRelated activities
Section titled “Related activities”- PDF Get Text (Page) — extract a single page.
- PDF Search Text — find which page a text is on.
- OCR Recognize File — for scanned PDFs, over the images from PDF To Images.