Actions80
- Add Attachment To PDF
- Add Barcode To PDF
- Add Form Fields To PDF
- Add HTML Header Footer
- Add Image Stamp To PDF
- Add Image Watermark To Image
- Add Margin To PDF
- Add Page Number To PDF
- Add Text Stamp To PDF
- Add Text Watermark To Image
- AI-Invoice Parser
- AI-Process Contract
- AI-Process HealthCard
- Classify Document
- Compress Image
- Compress PDF
- Convert HTML To PDF
- Convert Image Format
- Convert JSON To Excel
- Convert Markdown To PDF
- Convert PDF To Editable PDF Using OCR
- Convert PDF To Excel
- Convert PDF To PowerPoint
- Convert PDF To Word
- Convert To PDF
- Convert URL to PDF
- Convert VISIO
- Convert Word to PDF Form
- Create Images From PDF
- Create PDF/A
- Create Swiss QR Bill
- Crop Image
- Delete Blank Pages From PDF
- Delete Unwanted Pages From PDF
- Split PDF By Barcode
- Disable Tracking Changes In Word
- Enable Tracking Changes In Word
- Extract Attachment From PDF
- Extract Form Data From PDF
- Extract Pages From PDF
- Extract Resources
- Extract Table From PDF
- Extract Text By Expression
- Extract Text From Word
- Fill PDF Form
- Find And Replace Text
- Flip Image
- Flatten PDF
- Generate Barcode
- Generate Document Single
- Generate Documents Multiple
- Get Document From Pdf4me
- Get Image Metadata
- Get PDF Metadata
- Split PDF By Swiss QR
- Get Tracking Changes In Word
- Image Extract Text
- Linearize PDF
- Merge Multiple PDFs
- Overlay PDFs
- Parse Document
- Protect PDF
- Read Barcode From Image
- Read Barcode From PDF
- Read SwissQR Code
- Remove EXIF Tags From Image
- Repair PDF Document
- Replace Text With Image
- Replace Text With Image In Word
- Resize Image
- Rotate Document
- Rotate Image
- Rotate Image By EXIF Data
- Rotate PDF Page
- Sign PDF
- Split PDF By Text
- Split PDF Regular
- Unlock PDF
- Update Hyperlinks Annotation
- Upload File To PDF4me
Overview
The node operation "Add HTML Header Footer" allows users to add custom HTML content as a header, footer, or both to an existing PDF document. This is useful for scenarios where you want to brand PDFs with company logos, disclaimers, page titles, or other repetitive information on each page or selected pages of the PDF.
Practical examples include:
- Adding a company logo and contact info as a header on all pages of a report.
- Inserting legal disclaimers or confidentiality notices as footers on contracts.
- Adding page numbers or document titles in headers or footers dynamically using HTML formatting.
The node supports multiple input methods for the source PDF: binary data from previous nodes, base64 encoded strings, or URLs pointing to the PDF file.
Properties
| Name | Meaning |
|---|---|
| Input Data Type | Choose how to provide the PDF file: "Binary Data" (from previous node), "Base64 String" (base64 encoded PDF content), or "URL" (link to the PDF file). |
| Input Binary Field | Name of the binary property containing the PDF file when using "Binary Data" input type (default is usually "data"). |
| Base64 PDF Content | Base64 encoded string of the PDF document content (used if "Base64 String" input type is selected). |
| PDF URL | URL to the PDF file to process (used if "URL" input type is selected). |
| HTML Content | The HTML markup to be added as header/footer. Supports plain HTML (not base64). Default example includes centered red text. |
| Location | Where to add the HTML content: "Header", "Footer", or "Both" (adds to both header and footer). |
| Pages | Comma-separated list or ranges of page indices to apply the header/footer to (e.g., "1,3,5" or "2-5"). Leave empty to apply to all pages. |
| Skip First Page | Boolean flag to skip adding the header/footer on the first page. |
| Margin Left (Px) | Left margin in pixels for the header/footer content placement. |
| Margin Right (Px) | Right margin in pixels for the header/footer content placement. |
| Margin Top (Px) | Top margin in pixels for the header/footer content placement. |
| Margin Bottom (Px) | Bottom margin in pixels for the header/footer content placement. |
| Output File Name | Filename for the resulting PDF with the added HTML header/footer. |
| Document Name | Name of the source PDF file for reference purposes. |
| Debug Mode | Enable debug logging to assist troubleshooting. |
| 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 as binary data under the specified binary data output name (default "data"). The output JSON typically contains metadata about the processed file along with the binary content representing the PDF with the added HTML header/footer.
If the input was binary data, the output will be a binary PDF file with the header/footer applied. If the input was base64 or URL, the output similarly provides the processed PDF in binary form ready for further workflow steps or download.
Dependencies
- Requires access to the PDF processing service or API that performs the actual addition of HTML headers/footers to PDF files.
- Needs appropriate API authentication credentials configured in n8n to connect to the PDF processing backend.
- For URL input type, requires network access to fetch the PDF from the provided URL.
Troubleshooting
Common issues:
- Invalid or inaccessible PDF URL leading to failure fetching the source PDF.
- Incorrect base64 string format causing decoding errors.
- Specifying page ranges incorrectly (e.g., invalid syntax) may cause no pages to be processed.
- Insufficient margins causing header/footer content to overlap with main PDF content.
- Large or complex HTML content might not render correctly depending on the PDF processor capabilities.
Error messages and resolutions:
- "Failed to fetch PDF from URL": Check URL accessibility and correctness.
- "Invalid base64 content": Verify the base64 string is properly encoded without extra characters.
- "Page range out of bounds": Ensure page indices are within the actual number of pages in the PDF.
- "API authentication failed": Confirm API credentials are set up correctly in n8n.
- Enabling Debug Mode can provide detailed logs to help identify issues.