0CodeKit icon

0CodeKit

A toolbox of no-code utilities

Actions132

PDF → Add Text Watermark to PDF

AI-generated

Overview

The node provides a utility to add a text watermark to PDF documents. It supports inputting the PDF either via a public URL or as binary buffer data. Users can customize the watermark text, font, size, color, opacity, position, alignment, rotation, and specify which pages to apply the watermark on. The output can be returned either as a downloadable URL or as binary data.

This node is beneficial in scenarios where you want to mark PDFs with labels such as "Confidential," "Draft," or any custom text for branding, security, or informational purposes. For example, a company might use it to automatically watermark invoices or reports before distribution.

Properties

Name Meaning
PDF URL Public URL of the PDF file to watermark.
PDF Buffer Binary buffer data of the PDF file to watermark.
Text The text string to use as the watermark (e.g., "Confidential").
Font The font used for the watermark text. Options: Courier, Helvetica, Times Roman.
Font Size The font size of the watermark text in points (e.g., 72).
Font Color The font color specified as a six-digit hexadecimal RGB code (e.g., CCCCCCC for light gray).
Opacity The opacity level of the watermark, from 0.0 (fully transparent) to 1.0 (fully opaque). Default is 0.3.
Anchor Position The page location where the watermark will be anchored. Options include Bottom Center, Bottom Left, Bottom Right, Center, Center Left, Center Right, Top Center, Top Left, Top Right. Default is Center.
Alignment The part of the watermark text aligned relative to the anchor position. Same options as Anchor Position. Default is Center.
X Offset Horizontal offset in points relative to the anchor position. Positive values move right; negative values move left.
Y Offset Vertical offset in points relative to the anchor position. Positive values move up; negative values move down.
Rotation Counter-clockwise rotation angle of the watermark text in degrees. Default is 45°.
Pages Specifies which pages to apply the watermark to. Supports ranges and relative page numbers (e.g., "1,3-5,^3-^1" where ^1 means last page).
File Name Desired name for the output PDF file.
Return as URL Boolean flag indicating whether to return the watermarked PDF as a downloadable URL (true) or as binary data (false).

Output

The node outputs the watermarked PDF either as:

  • A downloadable URL if "Return as URL" is set to true.
  • Binary data representing the watermarked PDF file if "Return as URL" is false.

The output JSON contains the resulting PDF content accordingly, suitable for further processing or saving.

Dependencies

  • Requires an API key credential for authentication with the external 0CodeKit service.
  • The node sends a POST request to the endpoint /pdf/watermark/text on the base URL https://prod.0codekit.com.
  • No additional environment variables are needed beyond the API key credential.

Troubleshooting

  • Common issues:

    • Providing both PDF URL and PDF Buffer empty or invalid will cause failure; ensure one valid input is provided.
    • Incorrect page range syntax in the "Pages" property may result in no watermark being applied.
    • Invalid hex color codes or font names not in the allowed list may cause errors.
    • Large PDFs or high-resolution watermarks may increase processing time.
  • Error messages:

    • Authentication errors indicate missing or invalid API key credentials.
    • HTTP errors from the external service may indicate network issues or service downtime.
    • Validation errors typically relate to incorrect input parameters like unsupported fonts or invalid page ranges.

To resolve these, verify inputs carefully, ensure valid credentials, and check network connectivity.

Links and References

Discussion