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. For example, automating the insertion of a company logo wherever a placeholder text like "{{logo}}" appears in a contract document.

Properties

Name Meaning
Word Document Input Type How the Word document is provided:
- Binary Data (from previous node)
- Base64 String (encoded Word document)
- URL (link to Word document)
Word Document Binary Property Name of the binary property containing the Word document (used if input type is Binary Data)
Word Document Name Name of the Word document file including extension (used if input type is Binary Data or Base64 or URL)
Base64 Word Document Content Base64 encoded content of the Word document (used if input type is Base64)
Word Document URL URL of the Word document (used if input type is URL)
Image Input Type How the image file is provided:
- Binary Data (from previous node)
- Base64 String (encoded image)
- URL (link to image file)
Image Binary Property Name of the binary property containing the image file (used if input type is Binary Data)
Image File Name Name of the image file including extension (used if input type is Binary Data or Base64 or URL)
Base64 Image Content Base64 encoded content of the image (used if input type is Base64)
Image URL URL of the image file (used if input type is URL)
Is First Page Skip Boolean flag indicating whether to skip replacing text on the first page
Page Numbers Specifies which pages to perform the replacement on; default is "1"
Search Text The exact text string in the Word document that should be replaced by the image
Output Binary Field Name Name of the binary property where the output Word document will be stored

Output

The node outputs a modified Word document with the specified text replaced by the provided image. The output is stored in a binary property named as per the "Output Binary Field Name" property (default "data"). This binary data represents the updated Word document file (.docx).

Dependencies

  • Requires access to the input Word document and image either as binary data, base64 strings, or URLs.
  • No explicit external API keys or services are indicated in the code snippet.
  • The node depends on internal action logic for "ReplaceTextWithImageInWord" which handles the actual processing.

Troubleshooting

  • Common issues:
    • Incorrect or missing input Word document or image data.
    • Invalid URLs or inaccessible resources when using URL input types.
    • Specified search text not found in the Word document, resulting in no replacements.
    • Incorrect page numbers format or values causing unexpected behavior.
  • Error messages:
    • Errors related to missing binary properties or invalid base64 content usually indicate misconfiguration of input properties.
    • Network errors when fetching documents or images from URLs.
  • Resolutions:
    • Verify that the input document and image are correctly provided according to the selected input type.
    • Ensure URLs are accessible and point directly to valid files.
    • Double-check the search text matches exactly the text in the document.
    • Use correct page number formats (e.g., "1", "1-3", "2,4").

Links and References

Discussion