PDF Generator API icon

PDF Generator API

Generate PDFs, manage templates, convert HTML/URLs to PDF, and perform PDF operations like watermarking, encryption, and optimization

PDF Service → Add Watermark

AI-generated

Overview

This node operation adds watermarks to existing PDF documents. It supports adding text watermarks, image watermarks, or both simultaneously. Users can provide the PDF either via a public URL or as base64 encoded content. The watermark can be customized with options such as color, font size, opacity, position, rotation for text, and position, rotation, scale for images. The output can be returned as a base64 JSON string, a binary file for download, or a URL to the processed PDF.

Use Case Examples

  1. Add a 'CONFIDENTIAL' text watermark in red color at the center of a PDF loaded from a URL.
  2. Add an image watermark from a URL to a PDF provided as base64 content, scaling the image and positioning it at the bottom right.
  3. Add both text and image watermarks to a PDF and get the result as a downloadable binary file.

Properties

Name Meaning
PDF Source Source of the PDF document to process, either from a public URL or base64 encoded content.
PDF URL Public URL to the PDF document, required if PDF Source is 'From URL'.
PDF Base64 Base64 encoded PDF content, required if PDF Source is 'From Base64'.
Output Format Format of the output: JSON with base64 string, binary file for download, or JSON with download URL.
Watermark Type Type(s) of watermark to add; can select text, image, or both.
Watermark Text Text to use as watermark, required if text watermark is selected.
Watermark Image URL URL to image file to use as watermark, required if image watermark is selected.
Text Watermark Options Additional customization options for text watermark such as color, font size, opacity, position, and rotation.
Image Watermark Options Additional customization options for image watermark such as position, rotation, and scale.

Output

Binary

Binary PDF file with the watermark added, suitable for download or further processing.

JSON

  • success - Indicates if the watermark operation was successful
  • operation - The operation performed, e.g., addWatermark
  • filename - Name of the output file when output is binary
  • format - Output format chosen (base64, file, or url)
  • fileSize - Size of the output file in bytes
  • text
    • color - Color of the text watermark (if text watermark added)
    • size - Font size of the text watermark (if text watermark added)
    • opacity - Opacity of the text watermark (if text watermark added)
    • position - Position of the text watermark on the page (if text watermark added)
    • rotation - Rotation angle of the text watermark (if text watermark added)
  • image
    • content_url - URL of the image used as watermark (if image watermark added)
    • position - Position of the image watermark on the page (if image watermark added)
    • rotation - Rotation angle of the image watermark (if image watermark added)
    • scale - Scale factor of the image watermark (if image watermark added)

Dependencies

  • An API key credential for the PDF Generator API service

Troubleshooting

  • Ensure the PDF source is correctly provided either as a valid URL or valid base64 string.
  • If adding a text watermark, the watermark text must not be empty.
  • If adding an image watermark, the watermark image URL must be a valid accessible URL.
  • Check that the output format is supported and correctly handled by downstream nodes or systems.
  • Common errors include invalid JSON in input parameters or missing required fields, which can be resolved by validating inputs before execution.

Links

Discussion