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 operation "Add Text Stamp To PDF" allows users to add a customizable text stamp onto PDF documents. This is useful for marking PDFs with labels such as "CONFIDENTIAL," "DRAFT," or any other custom text to indicate status, ownership, or other metadata directly on the document pages.

Common scenarios include:

  • Adding watermarks or stamps to official documents before sharing.
  • Marking drafts or confidential files automatically in workflows.
  • Branding PDFs with company names or disclaimers.

Practical example: Automatically stamping all invoices generated in a workflow with the text "PAID" on the first page, centered horizontally and vertically, with semi-transparent red text rotated at 45 degrees.

Properties

Name Meaning
Input Data Type How the PDF file is provided: "Binary Data" (from previous node), "Base64 String" (direct base64 content), or "URL" (link to PDF file).
Input Binary Field The name of the binary property containing the PDF file when using "Binary Data" input type.
Base64 PDF Content Base64 encoded string of the PDF document content when using "Base64 String" input type.
PDF URL URL pointing to the PDF file when using "URL" input type.
Output File Name Desired filename for the output PDF with the text stamp applied.
Document Name Reference name of the source PDF file.
Text The actual text string to be stamped onto the PDF pages.
Pages Page range where the text stamp should be applied (e.g., "1", "1-3", "all").
Horizontal Alignment Horizontal alignment of the text stamp on the page: Left, Center, or Right.
Vertical Alignment Vertical alignment of the text stamp on the page: Top, Middle, or Bottom.
Horizontal Margin (Mm) Horizontal margin in millimeters to offset the text stamp from the aligned edge.
Vertical Margin (Mm) Vertical margin in millimeters to offset the text stamp from the aligned edge.
Opacity Opacity level of the text stamp, from 0 (fully transparent) to 100 (fully opaque). Default is 50 (semi-transparent).
Font Size Font size of the stamped text, ranging from 8 to 72 points.
Font Color Hex color code specifying the font color of the text stamp (e.g., "#FF0000" for red).
Rotation Rotation angle in degrees for the text stamp (e.g., 45 degrees).
Background Boolean indicating if the text stamp should be placed in the background (true) or foreground (false).
Async Processing Boolean to enable asynchronous processing, recommended for large files or many calls to reduce server load.
Advanced Options Collection for additional custom JSON profiles to adjust extra API call properties.
Binary Data Output Name Custom name for the binary data field in the node's output. Defaults to "data".

Output

The node outputs the modified PDF document with the text stamp applied. The output includes:

  • A JSON object containing metadata about the processed file.
  • A binary data field containing the stamped PDF file content, named according to the "Binary Data Output Name" property (default "data").

If the input was binary or base64, the output will be a binary PDF file ready for further use or download. If the input was a URL, the output similarly contains the stamped PDF binary data.

Dependencies

  • Requires access to an external PDF processing service API that supports adding text stamps to PDFs.
  • Needs proper API authentication configured in n8n credentials (an API key or token).
  • Network access to fetch PDFs by URL if the "URL" input type is used.
  • Optional advanced configuration via JSON profiles for fine-tuning API behavior.

Troubleshooting

  • Common issues:

    • Invalid or inaccessible PDF URL leading to fetch errors.
    • Incorrect base64 content causing decoding failures.
    • Unsupported page ranges or invalid page numbers.
    • API authentication failures due to missing or incorrect credentials.
    • Large files may cause timeouts if async processing is disabled.
  • Error messages and resolutions:

    • "Failed to fetch PDF from URL": Check URL accessibility and network connectivity.
    • "Invalid base64 content": Verify the base64 string is correctly encoded.
    • "Page range out of bounds": Ensure specified pages exist in the PDF.
    • "Authentication failed": Confirm API credentials are set up properly.
    • Timeout or server errors: Enable async processing or split large files into smaller batches.

Links and References

Discussion