Skip to main content

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:

  1. Add PDF4me node to workflow
  2. Select "Replace Text With Image In Word" action
  3. Configure input parameters (see below)
Replace Text With Image In Word

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.

ParameterTypeDescriptionExample
Word Document Input Type***StringWord 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 PropertyStringWord 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 ContentStringBase64 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 URLStringPublic 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***StringWord 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***StringImage 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 PropertyStringImage 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 ContentStringBase64 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 URLStringPublic 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***StringImage 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***StringText 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***StringTarget 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***StringBinary 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 SkipBooleanFirst 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:

ParameterTypeDescriptionExample
Custom ProfilesStringNoPDF4me 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

ParameterTypeDescriptionExample
successBooleanPDF4me 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 workflowstrue
messageStringPDF4me text replacement operation status message - Human-readable status message providing details about the text replacement process result. Includes success confirmation or error details for troubleshootingText replaced with image successfully
fileNameStringPDF4me 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 processesdocument_with_images.docx
mimeTypeStringPDF4me 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 applicationsapplication/vnd.openxmlformats-officedocument.wordprocessingml.document
fileSizeNumberPDF4me 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 automation125430
docNameStringPDF4me document name reference - The name of the processed Word document for reference and tracking purposes. This matches the fileName for consistency in document management workflowsdocument_with_images.docx
textReplacementCompletedBooleanPDF4me 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 correctlytrue
replacementsMadeNumberPDF4me 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 results3

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 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
}
]

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

Get Help