Replace Text With Image In Word using n8n action
PDF4me Replace Text With Image In Word replaces specified text with custom images in Microsoft Word documents through n8n automation workflows. Process Word files 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, optional first-page exclusion, and preserved document formatting. This solution is ideal for logo insertion, signature placement, template customization, branding automation, placeholder replacement, 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 In Word" 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" action
- Configure input parameters (see below)

Parameters
Complete list of parameters for the Replace Text With Image In Word action. Configure these parameters to control text-to-image replacement.
Important: Parameters marked with an asterisk (***) are required and must be provided for the action to function correctly.
| Parameter | Type | Description | Example |
|---|---|---|---|
| Word Document Input Type*** | String | Word Document Input Format Selection • Choose the format of your Word document input • PDF4me supports multiple input types • Options: Binary Data, Base64 String, or URL | Binary Data |
| Word Document Binary Property | String | Word Document Binary Data Reference (Required if Binary Data) • Specify the property name for accessing binary Word document data • Should match the binary data property name in your workflow • Required when Word Document Input Type is "Binary Data" | data |
| Base64 Word Document Content | String | Base64 Encoded Word Input (Required if Base64 String) • Provide Word document data as base64 encoded string • PDF4me automatically decodes and processes the document content • Required when Word Document Input Type is "Base64 String" | UEsDBBQABgAI... |
| Word Document URL | String | Public Word URL Input (Required if URL) • Provide a public/open permission URL to the Word document • PDF4me downloads and processes the file from the provided URL • Required when Word Document Input Type is "URL" | https://abc.com/sam.docx |
| Word Document Name*** | String | Word Document Filename • Specify the name of the Word document being processed • Helps with file identification and processing order • Used in text replacement operation | document.docx |
| Image Input Type*** | String | Image Input Format Selection • Choose the format of your image data input • PDF4me supports multiple input types • Options: Binary Data, Base64 String, or URL | Binary Data |
| Image Binary Property | String | Image Binary Data Reference (Required if Binary Data) • Specify the property name for accessing binary image data • Should match the binary data property name in your workflow • Required when Image Input Type is "Binary Data" | data |
| Base64 Image Content | String | Base64 Encoded Image Input (Required if Base64 String) • Provide image data as base64 encoded string • PDF4me automatically decodes and processes the image content • Required when Image Input Type is "Base64 String" | UEsDBBQABgAI... |
| Image URL | String | Public Image URL Input (Required if URL) • Provide a public/open permission URL to the image file • PDF4me downloads and processes the image from the provided URL • Required when Image Input Type is "URL" | https://abc.com/logo.png |
| Image File Name*** | String | Image Filename • Specify the name of the image file being processed • Helps with file identification and processing order • Used in text replacement operation | image.png |
| Search Text*** | String | Text Search Specification • Specify the exact text string to search for and replace • This text will be completely replaced by the provided image • Used for precise text-to-image replacement | [LOGO_PLACEHOLDER] |
| Page Numbers*** | String | Target Page Specification • Specify the page numbers where text replacement should occur • Use single pages (1), ranges (1-5), or mixed formats (1,3,5-7) • Essential for precise targeting | 1 |
| Output Binary Field Name*** | String | Binary Data Mapping • Define the variable name for accessing generated Word document data • Used in subsequent workflow actions • Essential for workflow data flow | data |
| Is First Page Skip | Boolean | First Page Exclusion • Enable to skip text replacement on the first page • Useful when first page contains headers or titles that shouldn't be modified • Optional for targeted replacement | false |
Advanced Options
The following parameters are available in the Advanced Options section and are optional:
| Parameter | Type | Description | Example |
|---|---|---|---|
| Custom Profiles | String | No | PDF4me custom configuration profiles - Set additional options for the PDF4me Replace Text With Image In Word operation using custom profiles. A custom profile is a string in JSON-like format containing predefined parameters for advanced text replacement settings. Supports options like outputDataFormat, preserveMetadata, optimizeForPrinting, compressionLevel, and colorSpaceOptimization |
Output
Output Parameters
| Parameter | Type | Description | Example |
|---|---|---|---|
| success | Boolean | PDF4me text replacement operation status indicator - Boolean flag indicating the success or failure of the Word text replacement process. PDF4me returns true for successful operations and false for any errors, enabling robust error handling in automated workflows | true |
| message | String | PDF4me text replacement operation 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 Word document filename - The complete filename of the successfully generated Word document with proper .docx extension. PDF4me ensures unique naming and validates file format compliance for seamless integration with downstream processes | document_with_images.docx |
| mimeType | String | PDF4me output MIME type - MIME type of the generated Word document, always "application/vnd.openxmlformats-officedocument.wordprocessingml.document" for .docx files. Useful for content type validation and proper file handling in web applications | application/vnd.openxmlformats-officedocument.wordprocessingml.document |
| fileSize | Number | PDF4me Word document file size in bytes - The exact size of the generated Word document in bytes, provided by PDF4me for storage planning, bandwidth optimization, and file transfer monitoring. Essential for enterprise document management and workflow automation | 125430 |
| docName | String | PDF4me document name reference - The name of the processed Word document for reference and tracking purposes. This matches the fileName for consistency in document management workflows | document_with_images.docx |
| textReplacementCompleted | Boolean | PDF4me text replacement completion confirmation - Boolean flag confirming that the text replacement operation has been successfully completed. Useful for verifying that the text was replaced with the image correctly | true |
| replacementsMade | Number | PDF4me text replacements count - The number of text instances that were successfully replaced with the image in the Word document. Useful for tracking replacement effectiveness and document processing results | 3 |
N8N Action Response
The PDF4me Replace Text With Image In Word 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": "document_with_images.docx",
"mimeType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"fileSize": 125430,
"docName": "document_with_images.docx",
"textReplacementCompleted": true,
"replacementsMade": 3
}
]
Table View
Response data in a structured table format:
| Parameter | Value |
|---|---|
| success | true |
| message | Text replaced with image successfully |
| fileName | document_with_images.docx |
| mimeType | application/vnd.openxmlformats-officedocument.wordprocessingml.document |
| fileSize | 125430 |
| docName | document_with_images.docx |
| textReplacementCompleted | true |
| replacementsMade | 3 |
Schema View
The data structure and types of the response:
1 item
success: ☑ true
message: AB Text replaced with image successfully
fileName: AB document_with_images.docx
mimeType: AB application/vnd.openxmlformats-officedocument.wordprocessingml.document
fileSize: # 125430
docName: AB document_with_images.docx
textReplacementCompleted: ☑ true
replacementsMade: # 3
Type Indicators:
AB= String#= Number☑= Boolean
Binary Data View
The actual Word document file data and metadata:
data
─────────────────────────────
File Name: document_with_images.docx
File Extension: docx
Mime Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document
File Size: 122.5 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
Document Branding and Visual Enhancement
- Automatically replace placeholder text with company logos, product images, or branding elements in Word documents for consistent visual identity across all business communications
- Process marketing materials and promotional documents by replacing text placeholders with high-quality product images, infographics, or visual content
- Enhance training materials and educational content by replacing text descriptions with relevant diagrams, charts, or instructional images for better learning experiences
Template Processing and Document Automation
- Process Word document templates by replacing placeholder text with dynamic images based on user data, creating personalized documents at scale
- Automate the generation of reports and presentations by replacing text markers with relevant charts, graphs, or visual data representations
- Streamline document production workflows by replacing text placeholders with images in batch processing operations for large document sets
Content Management and Visual Documentation
- Enhance technical documentation and user manuals by replacing text descriptions with screenshots, diagrams, or step-by-step visual guides
- Process legal documents and contracts by replacing text placeholders with signatures, stamps, or official seals for document authentication
- Automate the creation of visual reports and presentations by replacing data placeholders with charts, graphs, or visual representations for better data communication