The 'Search and Replace Text' flow action provides the capability to search for text fragments within PDF documents and replace with alternative text. To redact text as opposed to replacing text with alternative text, review the 'Redact PDF' article.
Whilst this action is limited to locating and replacing text from within PDF documents, simply convert files to PDF format using the 'Convert to PDF' flow action prior to executing this action.
Please refer to the Supported Document Types articles for a complete list of the different file formats / document types which are supported for PDF conversion.
The default 'Search and Replace Text' flow action parameters are detailed below:
- Filename: The PDF filename (including file extension)
- File Content: (Optional) A Base64 encoded representation of the PDF file to be processed.
- Operation ID: (Optional) The ID of a parent operation, please refer to: Flow Action Return Options: File Content vs. Operation ID
- Phrases: An array of phrases (See below for further details)
For each phrase; the 'Search Text' value will be replaced with the 'Replacement Text' value. By default; Text fragments are located by finding matching instances of the 'Search Text' parameter, to use a regular expression search simply set the 'Is Expression' value to true so that the 'Search Text' parameter will be treated as a regular expression and not a free text search.
Multiple phrases can be included within a single operation. To add more than one phrase click the 'Add new item' button:
- Search Text: The text or expression to use to locate matching text fragments.
- Is Expression: Set whether the 'Search Text' parameter should be treated as free text or regular expression.
- Replacement Text: The text which should be used to replace the text fragments with.
- Font: Specify the name of the font, if the font cannot be found the default 'Arial' font will be used
- Font Colour: Set the HTML colour of the font, the default colour is set to '#000000'
- Font Size: Set the HTML colour of the font, the default colour is set to '#000000'
- Background Colour: Set the HTML colour of the font background, the default colour is set to '#FFFFFF'
- Underline: Set whether the font should be underlined.
- Word Spacing: Set the word spacing value in pts.
- Line Spacing: Set the line spacing value in pts.
We recommend using the https://regexr.com/ site for regular expression creation and testing.
Please refer to the Obtaining the 'File Contents' Parameter article for guidance on how to obtain the 'File Content' parameter ready to provide to an Encodian flow action.
The advanced 'Search and Replace' flow action parameters are detailed below:
- Final Operation: Sets whether the this is last Encodian flow action.
Please refer to the Flow Action Return Options: File Content vs. Operation ID article for further details on the 'Final Operation' parameter.
The 'Search and Replace Text' flow action returns the following data.
Standard Return Values
- Filename - The filename of the document.
- FileContent - The processed PDF document content.
- OperationId - The unique ID assigned to this operation.
- HttpStatusCode - The HTTP Status code for the response.
- HttpStatusMessage - The HTTP Status message for the response.
- Errors - An array of error messages should an error occur.
- Operation Status - Indicates whether the operation has completed, has been queued or has failed.