Replace Text With Image in Word Document using n8n action
PDF4me Replace Text With Image in Word Document enables replacing specified text with images in Word documents through n8n automation workflows with advanced page filtering and size control options. This powerful text replacement feature supports precise text matching, image insertion, customizable sizing with aspect ratio preservation, page-specific targeting, and flexible filtering options with full control over replacement behavior, perfect for document automation, template processing, and dynamic content insertion workflows.
Setup
Add the PDF4me "Replace Text With Image in Word Document" 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 in Word Document" action
- Configure input parameters (see below)

Parameters
Complete list of parameters for the Replace Text With Image in Word Document action. Configure these parameters to control text replacement behavior.
Important: Parameters marked with an asterisk (***) are required. Advanced parameters provide fine-grained control over image sizing and page filtering.
| Parameter | Type | Description | Example |
|---|---|---|---|
| Input Data Type*** | String | Word Document Input Format Selection • Choose the format of your Word document data input • PDF4me supports multiple input types • Options: Binary Data, Base64 String, or URL | Binary Data |
| Input Binary Field*** | Binary | Binary Word File Input (Required if Binary Data) • Reference Word file (.docx, .doc) from previous n8n node or file upload • PDF4me processes binary Word files with automatic format detection • Required when Input Data Type is "Binary Data" | {{ $binary.data }} |
| Base64 Word Content*** | String | Base64 Encoded Word Input (Required if Base64 String) • Provide Word content (.docx, .doc) as base64 encoded string for secure transmission • PDF4me automatically decodes and processes the Word content • Required when Input Data Type is "Base64 String" | UEsDBBQABgAI... |
| Word Document URL*** | String | Public Word Document URL Input (Required if URL) • Provide a public/open permission URL to the Word file (.docx, .doc) to be processed • PDF4me downloads and processes the Word file from the provided URL • Required when Input Data Type is "URL" | https://abc.com/document.docx |
| Word Document Name*** | String | Word Document Input Filename • Specify the name of the input Word file with proper extension (.docx, .doc) • PDF4me uses this for format detection and processing optimization | document.docx |
| Search Text*** | String | Text to Search and Replace • Text string to search for in the document • Case-sensitive text matching • All instances of this text will be replaced with the image • Cannot be null or empty | "SIGN_HERE" |
| Image Content*** | Base64 | Replacement Image Content • Base64-encoded content of the image file • Must be valid image file (PNG, JPG, JPEG, BMP, GIF formats) | iVBORw0KGgoAAAANSUhEUg... |
| Image Width | Number | Image Width in Points • Width of the replacement image in points • Optional - if not specified, uses original image width • If only Width specified, Height calculated to maintain aspect ratio | 200 |
| Image Height | Number | Image Height in Points • Height of the replacement image in points • Optional - if not specified, uses original image height • If only Height specified, Width calculated to maintain aspect ratio | 150 |
| Maintain Aspect Ratio | Boolean | Preserve Image Proportions • Yes - Maintains original image aspect ratio when resizing (default) • No - Uses exact width and height values (may distort image) | Yes |
| Skip First Page | Boolean | Skip Replacement on First Page • Yes - Skip text replacement on the first page • No - Include first page in replacement process (default) | No |
| Apply To Pages | String | Apply Replacement to Specific Page Types • all - Apply to all pages (default) • odd - Apply only to odd-numbered pages • even - Apply only to even-numbered pages • first - Apply only to the first page • last - Apply only to the last page | "all" |
| Page Numbers | String | Specific Page Numbers or Ranges • Comma-separated page numbers or ranges (e.g., "1,3,5-7") • Can be used with Apply To Pages for combined filtering | "1,3,5-7" |
| Ignore Page Numbers | String | Page Numbers to Skip • Comma-separated page numbers to exclude from processing • Applied after other page filtering options | "2,4" |
| Culture Name | String | Document Culture/Locale • Culture code for document processing (e.g., "en-US", "fr-FR", "de-DE") • Default: null (no culture-specific processing) | en-US |
Output
Output Parameters
| Parameter | Type | Description | Example |
|---|---|---|---|
| fileName | String | Word document filename with text replaced by image - The name of the output Word document file after text-to-image replacement | document_text_replaced_with_image.docx |
| fileSize | Number | File size in bytes - The size of the Word document in bytes after text-to-image replacement | 14070 |
| success | Boolean | PDF4me operation status - Boolean flag indicating the success or failure of the text replacement operation. PDF4me returns true for successful operations and false for any errors | true |
| originalFileName | String | Original Word document filename - The name of the input Word document file | document.docx |
| findText | String | Search text used - The text string that was searched for and replaced with the image | PDF4me |
| maintainAspectRatio | Boolean | Aspect ratio preservation status - Indicates whether the image aspect ratio was maintained during replacement. true if aspect ratio was preserved, false if exact dimensions were used | true |
| skipFirstPage | Boolean | First page skip status - Indicates whether the first page was skipped during replacement. true if first page was skipped, false if first page was included | false |
| applyTo | String | Page filter applied - The page filter that was applied during replacement. Values: "all", "odd", "even", "first", "last" | all |
| cultureName | String | Culture/Locale code - Culture code used for document processing (e.g., "en-US", "de-DE", "fr-FR") | en-US |
| message | String | Operation message - Descriptive message indicating the result of the text-to-image replacement operation | Text replaced with image successfully |
N8N Action Response
The PDF4me Replace Text With Image in Word Document 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:
[
{
"fileName": "document_text_replaced_with_image.docx",
"fileSize": 14070,
"success": true,
"originalFileName": "document.docx",
"findText": "PDF4me",
"maintainAspectRatio": true,
"skipFirstPage": false,
"applyTo": "all",
"cultureName": "en-US",
"message": "Text replaced with image successfully"
}
]
Table View
Response data in a structured table format:
| Parameter | Value |
|---|---|
| fileName | document_text_replaced_with_image.docx |
| fileSize | 14070 |
| success | true |
| originalFileName | document.docx |
| findText | PDF4me |
| maintainAspectRatio | true |
| skipFirstPage | false |
| applyTo | all |
| cultureName | en-US |
| message | Text replaced with image successfully |
Schema View
The data structure and types of the response:
1 item
fileName: T document_text_replaced_with_image.docx
fileSize: # 14070
success: ☑ true
originalFileName: T document.docx
findText: T PDF4me
maintainAspectRatio: ☑ true
skipFirstPage: ☑ false
applyTo: T all
cultureName: T en-US
message: T Text replaced with image successfully
Type Indicators:
T= String (Text)#= Number☑= Boolean[]= Array
Binary Data View
The actual Word document file data and metadata:
data
─────────────────────────────
File Name: document_text_replaced_with_image.docx
File Extension: docx
Mime Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document
File Size: 14.1 kB
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
Enterprise Document Automation
- Document Automation: Replace placeholder text with dynamic images
- Template Processing: Insert logos, signatures, or charts into templates
- Document Personalization: Add personalized images to documents
- Report Generation: Insert charts and graphs into reports
AI-Powered Document Processing
- Multi-Format Support: Process Word documents in .docx and .doc formats
- Multi-Language Processing: Support for different languages and regions
- Intelligent Image Insertion: Automatic image sizing and positioning
Business Intelligence and Analytics
- Document Management: Organize documents with proper image placement
- Compliance Monitoring: Ensure documents meet formatting requirements
- Performance Metrics: Track processing accuracy and efficiency