Actions10
Overview
The "Add Watermark" operation of the PDF Tools node allows you to add a textual watermark to one or more pages of an existing PDF document. This is useful for branding, copyright marking, or adding confidential labels such as "Draft" or "Confidential" on PDF files.
Typical use cases include:
- Adding a company logo or text watermark to official documents.
- Marking PDFs as confidential or draft before sharing.
- Customizing PDFs with personalized watermarks for tracking.
For example, you can add the text "CONFIDENTIAL" in gray color with 30% opacity centered on all pages of a PDF.
Properties
| Name | Meaning |
|---|---|
| PDF Binary Field | Name of the binary field containing the PDF file to which the watermark will be added. |
| Watermark Text | The text string that will be used as the watermark on the PDF pages. |
| Page Target | Specifies which pages to apply the watermark to. Examples: "1", "1,3-5", or "all". |
| Watermark Options | Collection of styling options for the watermark: |
| - Font Size | Numeric font size of the watermark text (default 50). |
| - Color | Color of the watermark text in hex format (default "#808080" - gray). |
| - Opacity | Opacity level of the watermark text from 0 (transparent) to 1 (opaque), default 0.3. |
Output
The output is a modified PDF file with the watermark applied. It is returned as binary data under the binary property with:
data: Base64 encoded PDF content including the watermark.fileName: Defaulted to"output.pdf".mimeType: Always"application/pdf".
No additional JSON fields are added beyond an empty JSON object {} accompanying the binary data.
Dependencies
- Requires the PDF manipulation library capable of loading and editing PDFs.
- No external API keys or services are needed; all processing is done locally within the node.
- Input PDF must be provided as binary data with MIME type
application/pdf.
Troubleshooting
- Missing PDF binary data: If the specified PDF binary field does not exist or is empty, the node will throw an error indicating no binary data found.
- Empty watermark text: The node requires non-empty watermark text; otherwise, it throws an error stating the watermark text is required.
- Invalid page target: Specifying invalid page numbers (e.g., out of range) will cause an error. Ensure page targets are valid and formatted correctly.
- Unsupported input file type: The input must be a PDF file (
application/pdf). Other formats will cause an error. - Color format errors: The color must be a valid hex string like
#RRGGBB. Invalid colors may cause unexpected results or errors.
Links and References
- PDF-lib Documentation – The underlying library used for PDF manipulation.
- n8n Documentation – For general guidance on using custom nodes and handling binary data.