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 Image Stamp To PDF allows users to add an image stamp onto a PDF document. This is useful for scenarios such as watermarking, branding, or marking documents with logos, signatures, or other images. The node supports various ways to provide both the source PDF and the image stamp, including binary data from previous nodes, base64 encoded strings, or URLs.

Practical examples include:

  • Adding a company logo as a background stamp on all pages of a contract PDF.
  • Stamping a "Confidential" image watermark on selected pages of a report.
  • Applying a signature image stamp on specific pages of an invoice PDF.

Properties

Name Meaning
Input Data Type How the PDF file is provided: Binary Data (from previous node), Base64 String, or URL to the PDF file.
Input Binary Field Name of the binary property containing the PDF file (used if Input Data Type is Binary Data).
Base64 PDF Content Base64 encoded string of the PDF content (used if Input Data Type is Base64 String).
PDF URL URL to the PDF file (used if Input Data Type is URL).
Output File Name Desired filename for the output PDF with the image stamp applied.
Document Name Reference name for the source PDF file.
Image Input Data Type How the image file for the stamp is provided: Base64 String, Binary Data (from previous node), or URL.
Image Binary Field Name of the binary property containing the image file (used if Image Input Data Type is Binary Data).
Base64 Image Content Base64 encoded string of the image content (used if Image Input Data Type is Base64 String).
Image URL URL to the image file (used if Image Input Data Type is URL).
Image Name Filename of the image stamp with extension (.png or .jpeg).
Pages Comma-separated list or ranges of page indices to apply the stamp to (e.g., "0,1,2-" or "1,2,3-7"). If empty, applies to all pages.
Horizontal Alignment Horizontal alignment of the image stamp on the page: Left, Center, or Right.
Vertical Alignment Vertical alignment of the image stamp on the page: Top, Middle, or Bottom.
Height (Mm) Height of the image stamp in millimeters. If 0, default height or aspect ratio is used.
Width (Mm) Width of the image stamp in millimeters. If 0, default width or aspect ratio is used.
Height (Px) Height of the image stamp in points (pixels). Example: 40pt.
Width (Px) Width of the image stamp in points (pixels). Example: 40pt.
Horizontal Margin (Mm) Horizontal margin in millimeters. For Left alignment, margin from left edge; for Right alignment, margin from right edge; ignored if Center aligned.
Vertical Margin (Mm) Vertical margin in millimeters. For Top alignment, margin from top edge; for Bottom alignment, margin from bottom edge; ignored if Middle aligned.
Horizontal Margin (Px) Horizontal margin in pixels from the left origin of the image stamp.
Vertical Margin (Px) Vertical margin in pixels from the top origin of the image stamp.
Opacity Opacity level of the image stamp from 0 (fully transparent) to 100 (fully opaque).
Background Stamp Boolean indicating whether the image should be used as a background stamp (true) or foreground (false).
Show Only in Print Boolean indicating whether the stamp should only be visible when printing (true) or also on screen (false).
Advanced Options Collection of advanced settings including:
- Custom Profiles: JSON string to adjust extra API properties.
- Enable Debug Mode: boolean to enable debugging and logging.
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 document with the image stamp applied. The output includes:

  • A JSON object containing metadata about the processed item.
  • A binary data field containing the stamped PDF file. The binary field name can be customized via the "Binary Data Output Name" property.

If the input was a PDF, the output is the same PDF with the image stamp added according to the specified parameters.

Dependencies

  • Requires access to the PDF processing API/service that performs the image stamping operation.
  • Requires proper authentication credentials (such as an API key) configured in n8n to interact with the external PDF service.
  • Network access may be needed if providing PDFs or images via URLs.

Troubleshooting

  • Common Issues:

    • Incorrect or missing input PDF or image data will cause failures.
    • Invalid page range syntax in the "Pages" property may result in no pages being stamped.
    • Providing incompatible image formats or unsupported file extensions in "Image Name" may cause errors.
    • Insufficient permissions or invalid API credentials will prevent successful API calls.
  • Error Messages:

    • Errors related to missing binary data fields indicate incorrect configuration of input binary property names.
    • API errors about invalid input files suggest issues with the provided PDF or image content.
    • Timeout or network errors may occur if URLs are unreachable or slow to respond.
  • Resolutions:

    • Verify that the input PDF and image data are correctly provided and accessible.
    • Check the formatting of page ranges and ensure they match expected patterns.
    • Confirm that API credentials are valid and have necessary permissions.
    • Use the "Enable Debug Mode" option in advanced settings to get detailed logs for troubleshooting.

Links and References

  • PDF4me API Documentation
  • General information on PDF stamping and watermarking techniques.
  • n8n documentation on handling binary data and credentials.

Discussion