Add HTML Header Footer to PDF using n8n action
PDF4me Add HTML Header Footer to PDF adds custom HTML headers and footers to PDF documents through n8n automation workflows. Process PDFs via n8n triggers, binary data, base64 strings, or public URLs to insert HTML content with CSS styling, custom positioning, dynamic page numbers, dates, company logos, images, hyperlinks, and page-specific formatting. This solution is ideal for document branding, corporate identity, professional letterheads, custom footers, legal disclaimers, and automated document enhancement workflows that require flexible HTML rendering with accurate styling and seamless integration.
Setup
Add the PDF4me "Add HTML Header Footer to PDF" node to your n8n workflow and configure the required parameters. For initial setup instructions, see our n8n Integration Guide.
Prerequisites:
- PDF4me API credentials
- n8n workflow access
Configuration:
- Add PDF4me node to workflow
- Select "Add HTML Header Footer to PDF" action
- Configure input parameters (see below)

Parameters
Complete list of parameters for the Add HTML Header Footer to PDF action. Configure these parameters to control header/footer addition.
Important: Parameters marked with an asterisk (***) are required and must be provided for the action to function correctly.
| Parameter | Type | Description | Example |
|---|---|---|---|
| Input Data Type*** | String | PDF Input Format Selection • Choose the format of your PDF data input • PDF4me supports multiple input types • Options: Binary Data, Base64 String, or URL | Binary Data |
| Input Binary Field | Binary | Binary PDF File Input (Required if Binary Data) • Reference PDF file from previous n8n node or file upload • PDF4me processes binary PDF files with automatic format detection • Required when Input Data Type is "Binary Data" | {{ $binary.data }} |
| Base64 Document Content | String | Base64 Encoded PDF Input (Required if Base64 String) • Provide PDF data as base64 encoded string • PDF4me automatically decodes and processes the PDF content • Required when Input Data Type is "Base64 String" | UEsDBBQABgAI... |
| File URL | String | Public PDF URL Input (Required if URL) • Provide a public/open permission URL to the PDF file • PDF4me downloads and processes the file from URL • Required when Input Data Type is "URL" | https://abc.com/sample.pdf |
| HTML Content*** | String | HTML Header/Footer Content • HTML code that will be rendered as header or footer • Supports full HTML5 elements and complete CSS3 styling • Includes responsive design, web fonts, and layout control • Essential for professional header/footer design | <div style="text-align: center;">Header</div> |
| Location*** | String | Header/Footer Placement • Choose whether to add HTML content as "Header" or "Footer" • Determines position on the PDF document • Essential for proper placement | Header |
| Pages*** | String | Page Specification • Define which pages should have the header/footer • Supports single pages (1,3,5), ranges (2-5), mixed (1,3,7-10), open ranges (2-) • Examples: "all" (all pages), "1,3,5" (specific pages), "2-5" (range) • Default is all pages if empty | 1,3,5 |
| Skip First Page | Boolean | First Page Control • When enabled, skips adding header/footer to first page • Useful for title pages or cover pages • Default is false | false |
| Margin Left (Px) | Number | Left Margin Setting • Left margin for the header/footer in pixels • Controls horizontal positioning from left edge • Default is 20 | 20 |
| Margin Right (Px) | Number | Right Margin Setting • Right margin for the header/footer in pixels • Controls horizontal positioning from right edge • Default is 20 | 20 |
| Margin Top (Px) | Number | Top Margin Setting • Top margin for the header/footer in pixels • Controls vertical positioning from top edge • Default is 50 | 50 |
| Margin Bottom (Px) | Number | Bottom Margin Setting • Bottom margin for the header/footer in pixels • Controls vertical positioning from bottom edge • Default is 50 | 50 |
| Output File Name*** | String | Enhanced PDF Output Filename • Specify the name for the generated PDF file • Must include .pdf extension • PDF4me ensures unique naming and format validation | document_with_html_header_footer.pdf |
| Document Name*** | String | Source PDF Reference • Specify the name of the source PDF file • For reference and tracking purposes • Helps with processing tracking | document.pdf |
| Debug Mode | Boolean | Debugging Control • Enable detailed logging and debugging information • Useful for troubleshooting HTML rendering issues • Default is false | false |
| Binary Data Output Name*** | String | Binary Data Output Mapping • Define the variable name for accessing generated PDF binary data • Used in subsequent workflow actions • Essential for workflow automation | data |
Output
Output Parameters
| Parameter | Type | Description | Example |
|---|---|---|---|
| fileName | String | PDF4me generated PDF filename - The complete filename of the successfully generated PDF document with proper .pdf extension. PDF4me ensures unique naming and validates file format compliance for seamless integration with downstream processes | document_with_html_header_footer.pdf |
| fileSize | Number | PDF4me PDF file size in bytes - The exact size of the generated PDF file in bytes, provided by PDF4me for storage planning, bandwidth optimization, and file transfer monitoring. Essential for enterprise document management and workflow automation | 125430 |
| success | Boolean | PDF4me header/footer status indicator - Boolean flag indicating the success or failure of the HTML header/footer addition process. PDF4me returns true for successful operations and false for any errors, enabling robust error handling in automated workflows | true |
| mimeType | String | PDF4me output MIME type - MIME type of the generated PDF file, always "application/pdf" for PDF documents. Useful for content type validation and proper file handling in web applications | application/pdf |
| pageCount | Number | PDF4me processed page count - Number of pages that were processed with the HTML header/footer. Provides verification of successful page processing and helps track document enhancement progress | 5 |
| message | String | PDF4me header/footer status message - Human-readable status message providing details about the header/footer addition process result. Includes success confirmation or error details for troubleshooting | HTML header/footer added to PDF successfully |
N8N Action Response
The PDF4me Add HTML Header Footer to PDF API returns a response that can be viewed in multiple formats. Choose the view that best fits your needs:
- JSON
- Table
- Schema
- Binary
JSON Response Format
The raw JSON response from the API:
[
{
"success": true,
"message": "HTML header/footer added to PDF successfully",
"fileName": "document_with_html_header_footer.pdf",
"mimeType": "application/pdf",
"fileSize": 125430,
"pageCount": 5
}
]
Table View
Response data in a structured table format:
| Parameter | Value |
|---|---|
| success | true |
| message | HTML header/footer added to PDF successfully |
| fileName | document_with_html_header_footer.pdf |
| mimeType | application/pdf |
| fileSize | 125430 |
| pageCount | 5 |
Schema View
The data structure and types of the response:
1 item
success: ☑ true
message: AB HTML header/footer added to PDF successfully
fileName: AB document_with_html_header_footer.pdf
mimeType: AB application/pdf
fileSize: # 125430
pageCount: # 5
Type Indicators:
AB= String#= Number☑= Boolean
Binary Data View
The actual PDF file data and metadata:
data
─────────────────────────────
File Name: document_with_html_header_footer.pdf
File Extension: pdf
Mime Type: application/pdf
File Size: 122.5 KB
Binary Data Access:
- n8n Binary Object:
$binary.data.data - Base64 Content: Available for direct use
- File Operations: Ready for download, email, or storage
Use Cases
Corporate Branding and Professional Presentation
- Add HTML headers and footers with company logos, branding elements, and corporate information to PDF documents for professional presentation and brand consistency
- Process business reports, proposals, and presentations by adding HTML headers and footers for corporate identity, professional appearance, and brand recognition
- Transform client documents, marketing materials, and business communications by adding HTML headers and footers for professional presentation and brand consistency
Document Information and Navigation
- Add HTML headers and footers with document information, page numbers, and navigation elements to PDF documents for improved document organization and user experience
- Process technical documentation, user guides, and reference materials by adding HTML headers and footers for better navigation, information display, and user experience
- Transform project documentation, reports, and deliverables by adding HTML headers and footers for project information, status tracking, and stakeholder communication
Compliance and Regulatory Documentation
- Add HTML headers and footers with compliance information, regulatory notices, and legal disclaimers to PDF documents for regulatory compliance and legal documentation
- Process official documents, contracts, and legal materials by adding HTML headers and footers for legal compliance, regulatory requirements, and official documentation
- Transform compliance reports, audit materials, and regulatory filings by adding HTML headers and footers for regulatory compliance, audit trails, and official documentation
Related Blogs
Step-by-step guides to add HTML headers and footers to PDFs: