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

This node operation "Add Page Number To PDF" allows users to add page numbers to an existing PDF document. It supports multiple input methods for the source PDF, including binary data from a previous node, a base64 encoded string, or a URL pointing to the PDF file. Users can customize the appearance and positioning of the page numbers, such as alignment, margins, font size, and style (bold/italic). There is also an option to skip numbering on the first page.

This functionality is useful in scenarios where you need to paginate reports, contracts, invoices, or any multipage PDF documents automatically within an automation workflow. For example, adding page numbers to a batch of generated PDFs before sending them out or archiving.

Properties

Name Meaning
Input Data Type Method to provide the PDF file: "Binary Data" (from previous node), "Base64 String" (base64 encoded PDF 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 to the PDF file when using "URL" input type.
Output File Name Desired filename for the output PDF with page numbers added.
Document Name Name of the source PDF file for reference purposes.
Horizontal Alignment Horizontal position of the page number on the page: Left, Center, or Right.
Vertical Alignment Vertical position of the page number on the page: Top, Middle, or Bottom.
Horizontal Margin (Mm) Horizontal margin in millimeters (0-100) from the edge of the page for the page number placement.
Vertical Margin (Mm) Vertical margin in millimeters (0-100) from the edge of the page for the page number placement.
Font Size Font size for the page numbering text, ranging from 8 to 72 points.
Set Bold Boolean flag to set the page numbering text in bold.
Set Italic Boolean flag to set the page numbering text in italic.
Skip First Page Boolean flag to skip adding page number on the first page of the document.
Advanced Options JSON string to specify custom profiles or additional API options for advanced customization.
Binary Data Output Name Custom name for the binary data field in the node's output containing the resulting PDF file.

Output

The node outputs the modified PDF document with page numbers added as binary data. The binary data field name can be customized via the "Binary Data Output Name" property. The output contains the PDF file ready for further processing or saving.

The json output typically includes metadata about the processed file, but the main content is the binary PDF data representing the paginated document.

Dependencies

  • Requires access to an external PDF processing service or API capable of adding page numbers to PDF files.
  • Needs appropriate API credentials or authentication tokens configured in n8n to interact with the PDF service.
  • Network access is required if providing the PDF via URL or if the service is cloud-based.

Troubleshooting

  • Common issues:

    • Invalid or inaccessible PDF URL leading to failure in fetching the source document.
    • Incorrect binary property name causing the node to not find the input PDF data.
    • Malformed base64 string input causing decoding errors.
    • Exceeding allowed font size or margin values outside specified ranges.
    • Missing or invalid API credentials preventing successful API calls.
  • Error messages and resolutions:

    • "Input PDF not found" — Verify the binary property name or input data source.
    • "Failed to fetch PDF from URL" — Check the URL accessibility and correctness.
    • "Invalid base64 content" — Ensure the base64 string is properly encoded without extra characters.
    • "API authentication failed" — Confirm that the API key or token is correctly configured in n8n credentials.
    • "Parameter out of range" — Adjust font size or margin values within allowed limits.

Links and References

Discussion