PDF4me icon

PDF4me

Comprehensive PDF and document processing: generate barcodes, convert files, extract data, manipulate images, and automate workflows with the PDF4ME API

Actions80

Overview

This node operation "Replace Text With Image In Word" allows users to replace specified text within a Word document with an image. It is useful in scenarios where dynamic content needs to be inserted into Word documents, such as adding logos, signatures, or other images in place of placeholder text.

Practical examples include:

  • Automatically inserting a company logo where a placeholder text like "{{logo}}" exists.
  • Replacing a signature placeholder with an actual signature image.
  • Embedding product images or icons dynamically based on input data.

The node supports multiple ways to provide both the Word document and the image: as binary data from previous nodes, base64 encoded strings, or URLs.

Properties

Name Meaning
Word Document Input Type How to provide the Word document. Options: Binary Data (from previous node), Base64 String, URL.
Word Document Binary Property Name of the binary property containing the Word document (used if Word Document Input Type is Binary Data).
Word Document Name Name of the Word document file including extension (used if Word Document Input Type is Binary Data).
Base64 Word Document Content Base64 encoded content of the Word document (used if Word Document Input Type is Base64).
Word Document Name (required) Name of the Word document file including extension (required if Word Document Input Type is Base64 or URL).
Word Document URL URL pointing to the Word document (used if Word Document Input Type is URL).
Image Input Type How to provide the image file. Options: Binary Data (from previous node), Base64 String, URL.
Image Binary Property Name of the binary property containing the image file (used if Image Input Type is Binary Data).
Image File Name Name of the image file including extension (used if Image Input Type is Binary Data).
Base64 Image Content Base64 encoded content of the image file (used if Image Input Type is Base64).
Image File Name (required) Name of the image file including extension (required if Image Input Type is Base64 or URL).
Image URL URL pointing to the image file (used if Image Input Type is URL).
Is First Page Skip Boolean flag indicating whether to skip the first page when searching for the text to replace.
Page Numbers Specifies which pages to search for the text to replace. Can be a single page number or a list/range of pages.
Search Text The exact text string in the Word document that should be replaced by the image. This is required.

Output

The output contains the modified Word document with the specified text replaced by the provided image. The document is typically returned as binary data suitable for further processing or saving.

  • json field: Contains metadata or status information about the operation.
  • Binary data: The updated Word document file with replacements applied.

If the node outputs binary data, it represents the new Word document after the replacement operation.

Dependencies

  • Requires access to the Word document either via binary input, base64 string, or URL.
  • Requires access to the image file similarly via binary input, base64 string, or URL.
  • No explicit external API keys or services are indicated in the code snippet; however, the node likely depends on internal libraries or services capable of manipulating Word documents and images.

Troubleshooting

  • Common issues:

    • Providing incorrect or missing Word document input (e.g., wrong binary property name or invalid URL).
    • Providing incorrect or missing image input.
    • The search text not found in the document, resulting in no replacements.
    • Incorrect page numbers format causing the search to fail or skip intended pages.
    • Skipping the first page when the text is only present there may cause no replacements.
  • Error messages:

    • Errors related to missing input data or invalid file formats.
    • Network errors if URLs are unreachable.
    • Parsing errors if the Word document is corrupted or unsupported.
  • Resolutions:

    • Verify all required inputs are correctly set and accessible.
    • Ensure the search text exactly matches the text in the document.
    • Check page numbers and skip flags to match the document structure.
    • Validate URLs and network connectivity if using URL inputs.

Links and References


This summary is based solely on static analysis of the provided source code and property definitions.

Discussion