Actions80
- Add Attachment To PDF
- Add Barcode To PDF
- Add Form Fields To PDF
- Add HTML Header Footer
- Add Image Stamp To PDF
- Add Image Watermark To Image
- Add Margin To PDF
- Add Page Number To PDF
- Add Text Stamp To PDF
- Add Text Watermark To Image
- AI-Invoice Parser
- AI-Process Contract
- AI-Process HealthCard
- Classify Document
- Compress Image
- Compress PDF
- Convert HTML To PDF
- Convert Image Format
- Convert JSON To Excel
- Convert Markdown To PDF
- Convert PDF To Editable PDF Using OCR
- Convert PDF To Excel
- Convert PDF To PowerPoint
- Convert PDF To Word
- Convert To PDF
- Convert URL to PDF
- Convert VISIO
- Convert Word to PDF Form
- Create Images From PDF
- Create PDF/A
- Create Swiss QR Bill
- Crop Image
- Delete Blank Pages From PDF
- Delete Unwanted Pages From PDF
- Split PDF By Barcode
- Disable Tracking Changes In Word
- Enable Tracking Changes In Word
- Extract Attachment From PDF
- Extract Form Data From PDF
- Extract Pages From PDF
- Extract Resources
- Extract Table From PDF
- Extract Text By Expression
- Extract Text From Word
- Fill PDF Form
- Find And Replace Text
- Flip Image
- Flatten PDF
- Generate Barcode
- Generate Document Single
- Generate Documents Multiple
- Get Document From Pdf4me
- Get Image Metadata
- Get PDF Metadata
- Split PDF By Swiss QR
- Get Tracking Changes In Word
- Image Extract Text
- Linearize PDF
- Merge Multiple PDFs
- Overlay PDFs
- Parse Document
- Protect PDF
- Read Barcode From Image
- Read Barcode From PDF
- Read SwissQR Code
- Remove EXIF Tags From Image
- Repair PDF Document
- Replace Text With Image
- Replace Text With Image In Word
- Resize Image
- Rotate Document
- Rotate Image
- Rotate Image By EXIF Data
- Rotate PDF Page
- Sign PDF
- Split PDF By Text
- Split PDF Regular
- Unlock PDF
- Update Hyperlinks Annotation
- Upload File To PDF4me
Overview
The node operation "Replace Text With Image" allows users to replace specific text occurrences within a PDF document with an image. This is useful in scenarios where you want to dynamically insert logos, signatures, stamps, or any graphical content in place of certain text placeholders inside PDFs.
Practical examples include:
- Replacing a placeholder text like "[SIGNATURE]" with an actual signature image on contract documents.
- Inserting company logos in place of text tags in marketing brochures.
- Adding watermarks or stamps by replacing designated text markers.
This operation supports flexible input methods for both the PDF and the replacement image, including binary data from previous nodes, base64 encoded strings, or URLs.
Properties
| Name | Meaning |
|---|---|
| PDF Input Data Type | How the PDF file is provided: - Binary Data (from previous node) - Base64 String (encoded PDF content) - URL (link to PDF file) |
| PDF Binary Field | Name of the binary property containing the PDF file (used if PDF Input Data Type is Binary Data) |
| PDF Base64 Content | Base64 encoded string of the PDF content (used if PDF Input Data Type is Base64 String) |
| PDF URL | URL to the PDF file (used if PDF Input Data Type is URL) |
| Image Input Data Type | How the replacement image is provided: - Binary Data (from previous node) - Base64 String (encoded image content) - URL (link to image file) |
| Image Binary Field | Name of the binary property containing the image file (used if Image Input Data Type is Binary Data) |
| Image Base64 Content | Base64 encoded string of the image content (used if Image Input Data Type is Base64 String) |
| Image URL | URL to the image file (used if Image Input Data Type is URL) |
| Text to Replace | The exact text string in the PDF that should be replaced with the image |
| Page Sequence | Specifies which pages to apply the replacement on. Can be "all", a single page number (e.g., "1"), multiple pages separated by commas (e.g., "1,3,5"), or a range (e.g., "2-5") |
| Image Height | Height of the replacement image in pixels (integer) |
| Image Width | Width of the replacement image in pixels (integer) |
| Output File Name | Desired filename for the output PDF after replacement (e.g., "my-replaced-pdf.pdf") |
| Async | Whether to enable asynchronous processing (true/false) |
| Binary Data Output Name | Custom name for the binary data field in the node's output (default is "data") |
Output
The node outputs the modified PDF as binary data under the specified binary data output name (default "data"). The output JSON contains metadata about the processed file, and the binary data holds the updated PDF content with the specified text replaced by the image.
If asynchronous processing is enabled, the node handles the operation accordingly but ultimately returns the updated PDF binary data.
Dependencies
- Requires access to the PDF and image files either via binary data from previous nodes, base64 encoded strings, or accessible URLs.
- No explicit external API keys or services are mentioned; the operation appears to be handled internally or via bundled dependencies.
- Proper configuration of input data fields is necessary to ensure correct file retrieval.
Troubleshooting
Common Issues:
- Incorrect or missing binary property names when using binary data inputs can cause failures in reading the PDF or image.
- Invalid base64 strings or inaccessible URLs will prevent loading the PDF or image.
- Specifying a text to replace that does not exist in the PDF will result in no changes.
- Improper page sequence format may cause the replacement to be skipped or applied incorrectly.
Error Messages:
- Errors related to file loading usually indicate issues with input data type or source.
- If the node throws errors about missing parameters, verify all required properties are set according to the selected input types.
- Timeout or async-related errors might occur if asynchronous processing is enabled but the environment does not support it properly.
Resolutions:
- Double-check the binary property names and ensure the previous node outputs the expected binary data.
- Validate base64 strings and URLs before running the workflow.
- Confirm the text to replace exactly matches the target text in the PDF, including case and whitespace.
- Use correct page sequence syntax as described.
Links and References
- PDF4me Documentation (general reference for PDF operations)
- n8n documentation on working with binary data
- Guides on base64 encoding and decoding for file handling