Replace Text With Image using n8n action
PDF4me Replace Text With Image replaces specified text in PDF documents with custom images through n8n automation workflows. Process PDFs and images via n8n triggers, binary data, base64 strings, or public URLs to automatically find text placeholders and replace them with images (logos, signatures, graphics) with page-specific targeting, preserved document formatting, and flexible positioning options. This solution is ideal for logo insertion, signature placement, template customization, placeholder replacement, branding automation, and automated document enhancement workflows that require accurate text-to-image replacement with professional formatting and seamless integration.
Setup
Add the PDF4me "Replace Text With Image" node to your n8n workflow and configure the required parameters. For initial setup instructions, see our n8n Integration Guide.
Prerequisites:
- PDF4me API credentials
- n8n workflow access
Configuration:
- Add PDF4me node to workflow
- Select "Replace Text With Image" action
- Configure input parameters (see below)

Parameters
Complete list of parameters for the Replace Text With Image action. Configure these parameters to control text replacement with images.
Important: Parameters marked with an asterisk (***) are required and must be provided for the action to function correctly.
| Parameter | Type | Description | Example |
|---|---|---|---|
| PDF Input Data Type | String | Yes | PDF4me PDF input format selection Choose the format of your source PDF document data input. PDF4me supports multiple input types with different field requirements |
| 1) Binary Data | Yes (One Required) | 1) Binary Data - Use "PDF Binary Field" to reference PDF file from previous node | |
| 2) Base64 String | Yes (One Required) | 2) Base64 String - Use "Base64 PDF Content" field for encoded PDF data | |
| 3) URL | Yes (One Required) | 3) URL - Use "PDF URL" field to provide a public/open permission URL to the PDF file to process | |
| PDF Binary Field | Binary | Yes (If Binary Data) | PDF4me binary PDF file input - Reference source PDF file from previous n8n node or file upload. PDF4me processes binary PDF files with automatic format detection and validation. Required when PDF Input Data Type is "Binary Data" |
| Base64 PDF Content | String | Yes (If Base64 String) | PDF4me base64 encoded PDF input - Provide source PDF document data as base64 encoded string for secure transmission. PDF4me automatically decodes and processes the PDF content. Required when PDF Input Data Type is "Base64 String" |
| PDF URL | String | Yes (If URL) | PDF4me public PDF URL input - Provide a public/open permission URL to the source PDF document to be processed for text replacement. PDF4me downloads and processes the file from the provided URL. Required when PDF Input Data Type is "URL" |
| Image Input Data Type | String | Yes | PDF4me image input format selection Choose the format of your replacement image data input. PDF4me supports multiple image input types with different field requirements |
| 1) Binary Data | Yes (One Required) | 1) Binary Data - Use "Image Binary Field" to reference image file from previous node | |
| 2) Base64 String | Yes (One Required) | 2) Base64 String - Use "Base64 Image Content" field for encoded image data | |
| 3) URL | Yes (One Required) | 3) URL - Use "Image URL" field to provide a public/open permission URL to the image file | |
| Image Binary Field | Binary | Yes (If Binary Data) | PDF4me binary image file input - Reference replacement image file (.jpg, .png, .gif, .bmp) from previous n8n node or file upload. PDF4me processes binary image files with automatic format detection and validation. Required when Image Input Data Type is "Binary Data" |
| Base64 Image Content | String | Yes (If Base64 String) | PDF4me base64 encoded image input - Provide replacement image data (.jpg, .png, .gif, .bmp) as base64 encoded string for secure transmission. PDF4me automatically decodes and processes the image content. Required when Image Input Data Type is "Base64 String" |
| Image URL | String | Yes (If URL) | PDF4me public image URL input - Provide a public/open permission URL to the replacement image file (.jpg, .png, .gif, .bmp) to be processed for text replacement. PDF4me downloads and processes the file from the provided URL. Required when Image Input Data Type is "URL" |
| Text to Replace | String | Yes | PDF4me target text specification - Specify the exact text string to be replaced with the image in the PDF document. This text must match exactly as it appears in the document, including spaces, punctuation, and capitalization. PDF4me performs precise text matching for accurate replacement |
| Page Sequence | String | No | PDF4me page targeting configuration - Specify which pages to process for text replacement. Use "all" for entire document, specific page numbers (e.g., "1,3,5"), or page ranges (e.g., "1-5"). PDF4me supports flexible page targeting for precise document processing |
| Image Height | Number | Yes | PDF4me image scaling height - Define the height of the replacement image in pixels. PDF4me automatically scales the image to fit the specified dimensions while maintaining aspect ratio for optimal visual integration |
| Image Width | Number | Yes | PDF4me image scaling width - Define the width of the replacement image in pixels. PDF4me automatically scales the image to fit the specified dimensions while maintaining aspect ratio for optimal visual integration |
| Output File Name | String | Yes | PDF4me output filename configuration - Specify the name for the generated PDF file with proper extension (.pdf). This is an input parameter that configures what the output file will be named. PDF4me ensures unique naming and validates file format compliance |
| Async | Boolean | No | PDF4me asynchronous processing - Enable asynchronous processing for large PDFs or when processing time is not critical. When enabled, the operation runs in the background and returns immediately |
| Binary Data Output Name | String | Yes | PDF4me output variable configuration - Define the variable name for accessing the generated PDF binary data in your n8n workflow. This binary data can be used as input data in subsequent actions within your workflow |
Output
Output Parameters
| Parameter | Type | Description | Example |
|---|---|---|---|
| success | Boolean | PDF4me text replacement status indicator - Boolean flag indicating the success or failure of the text-to-image replacement process. PDF4me returns true for successful operations and false for any errors, enabling robust error handling in automated workflows | true |
| message | String | PDF4me replacement status message - Human-readable status message providing details about the text replacement process result. Includes success confirmation or error details for troubleshooting | Text replaced with image successfully |
| fileName | String | PDF4me generated PDF filename - The complete filename of the successfully generated PDF file with proper extension. PDF4me ensures unique naming and validates file format compliance for seamless integration with downstream processes | replaced_text_with_image.pdf |
| mimeType | String | PDF4me output MIME type - MIME type of the generated PDF file (e.g., "application/pdf"). Useful for content type validation and proper file handling in web applications | application/pdf |
| fileSize | Number | PDF4me processed PDF file size in bytes - The exact size of the generated PDF file in bytes, provided by PDF4me for storage planning and file transfer monitoring | 2048576 |
| pagesProcessed | Number | PDF4me page processing count - Number of pages that were processed for text replacement. Useful for tracking processing scope and verifying complete document coverage | 5 |
N8N Action Response
The PDF4me Replace Text With Image API returns a response that can be viewed in multiple formats. Choose the view that best fits your needs:
- JSON
- Table
- Schema
- Binary
JSON Response Format
The raw JSON response from the API:
[
{
"success": true,
"message": "Text replaced with image successfully",
"fileName": "replaced_text_with_image.pdf",
"mimeType": "application/pdf",
"fileSize": 2048576,
"pagesProcessed": 5
}
]
Table View
Response data in a structured table format:
| Parameter | Value |
|---|---|
| success | true |
| message | Text replaced with image successfully |
| fileName | replaced_text_with_image.pdf |
| mimeType | application/pdf |
| fileSize | 2048576 |
| pagesProcessed | 5 |
Schema View
The data structure and types of the response:
1 item
success: ☑ true
message: AB Text replaced with image successfully
fileName: AB replaced_text_with_image.pdf
mimeType: AB application/pdf
fileSize: # 2048576
pagesProcessed: # 5
Type Indicators:
AB= String#= Number☑= Boolean
Binary Data View
The actual processed PDF file and information:
data
─────────────────────────────
File Name: replaced_text_with_image.pdf
File Extension: pdf
Mime Type: application/pdf
File Size: 2,048,576 bytes
Pages Processed: 5
Text Replacements: Completed
Binary Data Access:
- n8n Binary Object:
$binary.data.data - Base64 Content: Available for direct use
- File Operations: Ready for download, email, or storage
Use Cases
Dynamic Document Branding and Personalization
- Replace placeholder text with company logos in automated document generation workflows
- Personalize marketing materials by substituting generic text with customer-specific images or branding
- Automate the insertion of product images into standardized documentation templates
Content Management and Visual Enhancement
- Transform text-based placeholders into rich visual content for improved document presentation
- Replace outdated text references with current images in bulk document processing workflows
- Enhance document readability by converting complex text descriptions into intuitive visual representations
Automated Report Generation and Template Processing
- Generate personalized reports by replacing template text with dynamic images based on data triggers
- Automate the creation of visual documentation by substituting text markers with relevant charts or diagrams
- Streamline template-based workflows by replacing placeholder text with context-specific imagery