Skip to main content

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:

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

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.

ParameterTypeDescriptionExample
PDF Input Data TypeStringYesPDF4me 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 DataYes (One Required)1) Binary Data - Use "PDF Binary Field" to reference PDF file from previous node
2) Base64 StringYes (One Required)2) Base64 String - Use "Base64 PDF Content" field for encoded PDF data
3) URLYes (One Required)3) URL - Use "PDF URL" field to provide a public/open permission URL to the PDF file to process
PDF Binary FieldBinaryYes (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 ContentStringYes (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 URLStringYes (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 TypeStringYesPDF4me 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 DataYes (One Required)1) Binary Data - Use "Image Binary Field" to reference image file from previous node
2) Base64 StringYes (One Required)2) Base64 String - Use "Base64 Image Content" field for encoded image data
3) URLYes (One Required)3) URL - Use "Image URL" field to provide a public/open permission URL to the image file
Image Binary FieldBinaryYes (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 ContentStringYes (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 URLStringYes (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 ReplaceStringYesPDF4me 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 SequenceStringNoPDF4me 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 HeightNumberYesPDF4me 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 WidthNumberYesPDF4me 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 NameStringYesPDF4me 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
AsyncBooleanNoPDF4me 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 NameStringYesPDF4me 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

ParameterTypeDescriptionExample
successBooleanPDF4me 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 workflowstrue
messageStringPDF4me replacement 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 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 processesreplaced_text_with_image.pdf
mimeTypeStringPDF4me 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 applicationsapplication/pdf
fileSizeNumberPDF4me 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 monitoring2048576
pagesProcessedNumberPDF4me page processing count - Number of pages that were processed for text replacement. Useful for tracking processing scope and verifying complete document coverage5

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

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

Get Help