PDF Contains Text
PDF Contains Text
Section titled “PDF Contains Text”Type: pdf-contains-text · Package: PDF Activities v1.2.4 · Output: bool
Checks whether the PDF contains a text on any of its pages and returns true or false. Useful to classify documents quickly: is it an invoice? does it include a given clause? does it mention a customer?
How it works
Section titled “How it works”Looks for text page by page, in the text extracted from each one (the same one PDF Get Text (Page) returns), and returns true as soon as it finds it, without reading the rest. By default the search is case-insensitive (caseSensitive = false). It doesn’t modify the file.
- It is a literal text search, not a regular expression. For patterns, use PDF Get Text and
regexMatch. - The search runs within each page: a text split between the end of one page and the start of the next is not found.
- If a phrase isn’t found even though you see it in the PDF, check how it comes out in the extracted text: spaces and line breaks may not be the ones you see on screen.
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
path | string | — | Path of the PDF file. |
text | string | — | Text to look for. |
Optional parameters
Section titled “Optional parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
caseSensitive | bool | false | Case-sensitive search. The Designer switch or an expression that returns true/false. Since 1.2.4. Any other value is an error. |
Output
Section titled “Output”Returns a bool: true if the text appears on any page, false otherwise. On a scanned PDF (no text layer) it returns false.
Common errors
Section titled “Common errors”| Message | Cause and fix |
|---|---|
File not found. | The path doesn’t exist. |
'caseSensitive' must be true or false. Received: …. | The caseSensitive expression didn’t return a yes/no. Since 1.2.4. |
'path' is required. / 'text' is required. | The parameter was left empty or its expression returned null. |
| PDF library error when opening the file | Password-protected or damaged PDF. See Protected and damaged PDFs. |
Example
Section titled “Example”Classify a PDF by its content:
PDF Contains Text path = filePath text = "ELECTRONIC INVOICE" → output: isInvoiceIf condition = isInvoice └─ then: Move File source = filePath destination = pathJoin("C:/invoices", fileName(filePath))Related activities
Section titled “Related activities”- PDF Search Text — return the pages where it appears.
- PDF Get Text — extract all the text to analyse it.