Actions80
- Extract Text From Word
- Find And Replace Text
- Convert PDF To Editable PDF Using OCR
- Create Swiss QR Bill
- Split PDF By Barcode
- Split PDF By Swiss QR
- Split PDF By Text
- Split PDF Regular
- Create PDF/A
- Convert HTML To PDF
- Convert Markdown To PDF
- Upload File To PDF4me
- Add Attachment To PDF
- Add Barcode To PDF
- Add Form Fields To PDF
- Fill PDF Form
- Add HTML Header Footer
- Add Image Stamp To PDF
- Add Margin To PDF
- Add Page Number To PDF
- Add Text Stamp To PDF
- AI-Invoice Parser
- AI-Process HealthCard
- AI-Process Contract
- Generate Barcode
- Classify Document
- Parse Document
- Linearize PDF
- Flatten PDF
- Convert To PDF
- Json To Excel
- Convert PDF To Excel
- Convert PDF To Word
- Convert PDF To PowerPoint
- Convert VISIO
- Crop Image
- Delete Blank Pages From PDF
- Delete Unwanted Pages From PDF
- Extract Pages
- Merge Multiple PDFs
- Overlay PDFs
- Rotate Document
- Rotate Page
- Sign PDF
- URL to PDF
- Add Image Watermark To Image
- Add Text Watermark To Image
- Compress Image
- Convert Image Format
- Create Images From PDF
- Flip Image
- Get Image Metadata
- Image Extract Text
- Remove EXIF Tags From Image
- Replace Text With Image
- Replace Text With Image In Word
- Resize Image
- Rotate Image
- Rotate Image By EXIF Data
- Compress PDF
- Get PDF Metadata
- Repair PDF Document
- Get Document From Pdf4me
- Update Hyperlinks Annotation
- Protect Document
- Unlock PDF
- Disable Tracking Changes In Word
- Enable Tracking Changes In Word
- Generate Document Single
- Generate Documents Multiple
- Get Tracking Changes In Word
- Read Barcode From Image
- Read Barcode From PDF
- Read SwissQR Code
- Extract Form Data From PDF
- Extract Pages From PDF
- Extract Attachment From PDF
- Extract Text By Expression
- Extract Table From PDF
- Extract Resources
Overview
This node operation "Add HTML Header Footer" allows users to add custom HTML content as a header, footer, or both 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.
Common scenarios where this node is beneficial include:
- Adding company branding or legal disclaimers as headers or footers on official PDF documents.
- Inserting page numbers, dates, or other dynamic information formatted in HTML.
- Enhancing PDFs with styled text or images in the header/footer areas without modifying the original content.
Practical example:
- A user receives invoices as PDFs and wants to add a red-colored centered header with the company name on every page except the first. They can provide the PDF as binary data, specify the HTML content for the header, set margins, and choose to skip the first page.
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 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, used if "URL" input type is selected. |
| HTML Content | The HTML markup to be added as header/footer. This is plain HTML (not base64) and can include styling such as fonts, colors, and alignment. |
| Location | Where to add the HTML content: "Header", "Footer", or "Both". |
| Pages | Specify which pages to process by indices or ranges (e.g., "1,3,5", "2-5", "1,3,7-10", or "2-"). 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 area. |
| Margin Right (Px) | Right margin in pixels for the header/footer area. |
| Margin Top (Px) | Top margin in pixels for the header/footer area. |
| Margin Bottom (Px) | Bottom margin in pixels for the header/footer area. |
| Output File Name | Desired filename for the output PDF with the added HTML header/footer. |
| Document Name | Name of the source PDF file for reference purposes. |
| Use Async Processing | Whether to use asynchronous processing mode, recommended for large files to improve performance. |
| Debug Mode | Enable debug logging to assist troubleshooting. |
Output
The node outputs the modified PDF document with the specified HTML header/footer applied. The output is typically provided as binary data representing the updated PDF file. The output also includes metadata such as the output file name.
If the input was binary data, the output will be binary data suitable for further processing or saving. If the input was base64 or URL, the output will similarly be the processed PDF content in binary form.
Dependencies
- Requires access to an external PDF processing service or API capable of rendering HTML into PDF headers/footers and merging it with the original PDF.
- Needs appropriate API credentials or authentication tokens configured in n8n to interact with the PDF processing backend.
- Network access is required if providing the PDF via URL or if the processing service is cloud-based.
Troubleshooting
Common issues:
- Invalid or inaccessible PDF URL: Ensure the URL is publicly accessible or reachable by the service.
- Incorrect base64 content: Verify that the base64 string represents a valid PDF document.
- Large PDF files may cause timeouts or slow processing; enable asynchronous processing to mitigate.
- Malformed HTML content might not render correctly; validate HTML syntax and supported styles.
Error messages:
- "Failed to load PDF": Check input PDF source and format.
- "HTML content invalid": Review the HTML content for errors or unsupported tags.
- "Timeout during processing": Enable async processing or reduce PDF size.
- Authentication errors: Confirm API keys or credentials are correctly set up.