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 | Required | What it does | Example |
|---|---|---|---|
| Input Data Type | Required | Choose how to provide the PDF file to add HTML header/footer to. Options: Binary Data, Base64 String, URL. Default is `Binary Data`. | Binary Data |
| Input Binary Field | Conditional | Name of the binary property that contains the PDF file (usually "data" for file uploads). Shown when Input Data Type is Binary Data. Default is `data`. | data |
| Base64 PDF Content | Conditional | Base64 encoded PDF document content. Shown when Input Data Type is Base64 String. | UEsDBBQABgAI... |
| PDF URL | Conditional | URL to the PDF file to add HTML header/footer to. Shown when Input Data Type is URL. | |
| HTML Content | Required | HTML content to be added as header/footer (plain HTML, not base64). Default is `<div style="text-align: center; font-family: Arial; font-size: 12px; color: #FF0000;">Document Header PDF4me</div>`. | <div style="text-align: center; font-family: Arial; font-size: 12px; color: #FF0000;">Document Header PDF4me</div> |
| Location | Required | Location where to add the HTML content. Options: Header, Footer, Both. Default is `Header`. | Header |
| Pages | Required | Specify page indices as comma-separated values or ranges to process (e.g. "0, 1, 2-" or "1, 2, 3-7"). Leave empty for all pages. | 1,3,5 |
| Skip First Page | Required | Whether to skip adding HTML header/footer to the first page. Default is `No`. | No |
| Margin Left (Px) | Required | Left margin in pixels. Default is `20`. | 20 |
| Margin Right (Px) | Required | Right margin in pixels. Default is `20`. | 20 |
| Margin Top (Px) | Required | Top margin in pixels. Default is `50`. | 50 |
| Margin Bottom (Px) | Required | Bottom margin in pixels. Default is `50`. | 50 |
| Output File Name | Optional | Name for the output PDF file with HTML header/footer. Default is `document_with_html_header_footer.pdf`. | document_with_html_header_footer.pdf |
| Document Name | Optional | Name of the source PDF file for reference. Default is `document.pdf`. | document.pdf |
| Binary Data Output Name | Optional | Custom name for the binary data in n8n output. Default is `data`. | data |
Output
Output Parameters
| Field | Type | What it contains |
|---|---|---|
success | Boolean | True when the operation succeeded. |
message | String | Status message, `HTML header/footer added successfully`. |
fileName | String | File name of the resulting file. |
mimeType | String | MIME type of the resulting file, for example `application/pdf`. |
fileSize | Number | Size of the resulting file in bytes. |
originalDocName | String | Name of the input PDF (for Base64 input, the Document Name field). |
location | String | Location that was used (Header, Footer or Both). |
pages | String | Pages value that was sent. |
skipFirstPage | String | Skip First Page value that was used. |
margins | String | Object with the margins that were used: left, right, top, bottom. |
data | Binary | The PDF with the HTML header and/or footer. |
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