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

The node performs a "Find And Replace Text" operation on PDF files. It allows users to search for specific text within a PDF document and replace it with new text. This is useful in scenarios where you need to update or correct text content in PDFs without manually editing the file, such as updating contract terms, correcting typos, or customizing documents dynamically.

Practical examples include:

  • Automatically replacing placeholders in PDF templates with actual data.
  • Correcting repeated errors in scanned or generated PDFs.
  • Updating product names or prices in PDF catalogs.

Properties

Name Meaning
PDF Input Data Type Choose how to provide the PDF file: Binary Data (from previous node), Base64 String (encoded PDF content), or URL (link to PDF file).
PDF Binary Field Name of the binary property containing the PDF file (used if input type is Binary Data).
PDF Base64 Content Base64 encoded string representing the PDF content (used if input type is Base64 String).
PDF URL URL pointing to the PDF file to process (used if input type is URL).
Old Text The text string to find within the PDF that should be replaced.
New Text The text string to replace the old text with.
Page Sequence Specifies which pages to process by indices or ranges (e.g., "1, 2, 3-7"). Leave empty to process all pages.
Output File Name Desired filename for the output PDF after text replacement.
Async Enable asynchronous processing (true/false).
Binary Data Output Name Custom name for the binary data field in the node's output (default is "data").

Output

The node outputs the modified PDF file as binary data under a customizable binary property name (default "data"). The JSON output contains metadata about the processed item, while the binary data holds the updated PDF content with the specified text replaced.

Dependencies

  • Requires access to the PDF processing service or library integrated into the node (likely an external API or SDK).
  • If using URL input, requires network access to fetch the PDF file.
  • For authentication, an API key or token credential is needed but is abstracted from this code.

Troubleshooting

  • Common issues:

    • Incorrect page sequence format may cause no changes or errors; ensure proper comma-separated values or ranges.
    • Providing an invalid PDF (corrupted or unsupported format) will result in processing failure.
    • If the old text does not exist in the PDF, the output PDF will remain unchanged.
    • Network issues when using URL input can prevent fetching the PDF.
  • Error messages:

    • Errors related to missing or invalid input properties (e.g., missing PDF content or old/new text) require checking node configuration.
    • API or service errors might indicate authentication problems or service unavailability; verify credentials and network connectivity.
    • Parsing errors suggest the PDF might be corrupted or incompatible.

Links and References

Discussion