Replace Text With Image in n8n
Replace Text With Image is an n8n node by PDF4me that finds an exact text placeholder inside a PDF and swaps it for a logo, signature, or product image at matching dimensions. Use it for template branding, signature insertion, or automated visual personalization without manually editing the PDF.
What this node does
PDF4me: Replace Text With Image scans a PDF for an exact text string and replaces every matching occurrence with an image, scaled to your chosen height and width, on the pages you target. Accepts both the source PDF and the replacement image via Binary Data, Base64 String, or URL, independently. Ideal for inserting logos, signatures, stamps, or product photos into templated PDFs.
Authenticating Your API Request
Every PDF4me node in n8n requires a valid Credential to connect with. Create or select one that holds your PDF4me API key so the workflow can authenticate the replacement request securely.
Important Facts You Should Not Miss
[LOGO_HERE] only matches that exact string, not a partial or case-different version.
PDF4me Replace Text With Image node parameters panel in n8n
What Parameters Does Replace Text With Image Need?
Required: PDF Input Data Type, Image Input Data Type, Text to Replace, Image Height, Image Width, and Output File Name. Conditional fields appear only when their parent Input Data Type is chosen. Page Sequence, Async, and Binary Data Output Name are optional with working defaults.
| Parameter | Required | What it does | Example |
|---|---|---|---|
| PDF Input Data Type | Required | Format of the source PDF input. Choose Binary Data (from a previous node), Base64 String, or URL. | Binary Data |
| PDF Binary Field | Conditional | Name of the binary property on the incoming n8n item that holds the source PDF. Required when PDF Input Data Type is Binary Data. | data |
| Base64 PDF Content | Conditional | Base64-encoded source PDF content. Required when PDF Input Data Type is Base64 String. | JVBERi0xLjQK... |
| PDF URL | Conditional | Publicly reachable HTTPS URL to the source PDF. Required when PDF Input Data Type is URL. | https://example.com/sample.pdf |
| Image Input Data Type | Required | Format of the replacement image input. Choose Binary Data, Base64 String, or URL, independent of the PDF input type. | Binary Data |
| Image Binary Field | Conditional | Name of the binary property on the incoming n8n item that holds the replacement image. Required when Image Input Data Type is Binary Data. | data |
| Base64 Image Content | Conditional | Base64-encoded replacement image content. Required when Image Input Data Type is Base64 String. | /9j/4AAQSkZJRgAB... |
| Image URL | Conditional | Publicly reachable HTTPS URL to the replacement image. Required when Image Input Data Type is URL. | https://example.com/logo.png |
| Text to Replace | Required | The exact text string to find and replace with the image, matched precisely including case and punctuation. | [LOGO_HERE] |
| Page Sequence | Optional | Pages to search for the placeholder. Use all, specific pages (1,3,5), or a range (1-5). Default all. | all |
| Image Height | Required | Height in pixels to scale the replacement image to, maintaining aspect ratio. | 50 |
| Image Width | Required | Width in pixels to scale the replacement image to, maintaining aspect ratio. | 100 |
| Output File Name | Required | Filename for the resulting PDF, must include the .pdf extension. | replace_text_with_image.pdf |
| Async | Optional | Enables background processing for large PDFs. Default false. | false |
| Binary Data Output Name | Optional | Name of the binary property the output item exposes. Default is data. | data |
Output Fields
A successful run returns one n8n item carrying JSON metadata and the updated binary PDF.
| Field | Type | What it contains |
|---|---|---|
success | Boolean | True when the replacement succeeded. Use to route error-handling branches. |
message | String | Human-readable status message for the replacement result. |
fileName | String | Generated filename, matching Output File Name. |
mimeType | String | MIME type of the output, always application/pdf. |
fileSize | Number | Size of the resulting PDF in bytes. |
pagesProcessed | Number | Number of pages searched for the placeholder text. |
Binary (data) | Binary | The updated PDF under Binary Data Output Name (default data). Pass into Write Binary File, Email, or any cloud-storage upload. |
How Do I Set Up Replace Text With Image in n8n?
- Add PDF4me to your n8n workflow and choose the Replace Text With Image action.
- In Credential to connect with, select your PDF4me credential or click Create New Credential and paste your API key.
- Set PDF Input Data Type and supply the source PDF via PDF Binary Field, Base64 PDF Content, or PDF URL.
- Set Image Input Data Type and supply the replacement image via Image Binary Field, Base64 Image Content, or Image URL.
- Enter Text to Replace exactly as it appears in the PDF, and set Page Sequence if you need to target specific pages.
- Set Image Height and Image Width to scale the replacement image, and set Output File Name.
- Enable Async for large PDFs if needed. Execute the node and route the updated PDF into the next step.
Typical Setups
Workflow ExamplesCommon n8n workflow patterns using Replace Text With Image.
- A CRM webhook fires when a new proposal is generated for a client.
- PDF4me Replace Text With Image runs with Text to Replace set to
[CLIENT_LOGO]and Image Input Data Type URL pointing to the client's logo. - The branded proposal is emailed to the sales rep for final review.
- A contract is generated via PDF4me Generate Document with a
[SIGNATURE]placeholder. - PDF4me Replace Text With Image runs with the signatory's signature image and Page Sequence targeting only the final page.
- The signed-looking contract is archived to SharePoint.
- A Loop Over Items node iterates product records from an inventory database.
- PDF4me Replace Text With Image runs per item, replacing a
[PRODUCT_IMAGE]placeholder with each product's photo from cloud storage. - Each personalized catalog page is combined downstream into a single distributable PDF.
- An approval webhook fires once a manager marks a document approved in an internal tool.
- PDF4me Replace Text With Image runs with a
[APPROVAL_STAMP]placeholder swapped for an approval graphic. - The finalized PDF is archived with the approval date in the filename.
Practical Tips
Cheat Sheet
| Field | Value |
|---|---|
| Action | Replace Text With Image |
| PDF Input Data Type | Binary Data |
| PDF Binary Field | data |
| Image Input Data Type | Binary Data |
| Image Binary Field | data |
| Text to Replace | [LOGO_HERE] |
| Page Sequence | all |
| Image Height | 50 |
| Image Width | 100 |
| Output File Name | replace_text_with_image.pdf |
| Credentials | PDF4me API credential |