Skip to main content

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:

  1. Add PDF4me node to workflow
  2. Select "Add HTML Header Footer to PDF" action
  3. Configure input parameters (see below)
Add HTML Header Footer to PDF

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.

ParameterTypeDescriptionExample
Input Data Type***StringPDF 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 FieldBinaryBinary 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 ContentStringBase64 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 URLStringPublic 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***StringHTML 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***StringHeader/Footer Placement
• Choose whether to add HTML content as "Header" or "Footer"
• Determines position on the PDF document
• Essential for proper placement
Header
Pages***StringPage 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 PageBooleanFirst 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)NumberLeft Margin Setting
• Left margin for the header/footer in pixels
• Controls horizontal positioning from left edge
• Default is 20
20
Margin Right (Px)NumberRight Margin Setting
• Right margin for the header/footer in pixels
• Controls horizontal positioning from right edge
• Default is 20
20
Margin Top (Px)NumberTop Margin Setting
• Top margin for the header/footer in pixels
• Controls vertical positioning from top edge
• Default is 50
50
Margin Bottom (Px)NumberBottom Margin Setting
• Bottom margin for the header/footer in pixels
• Controls vertical positioning from bottom edge
• Default is 50
50
Output File Name***StringEnhanced 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***StringSource PDF Reference
• Specify the name of the source PDF file
• For reference and tracking purposes
• Helps with processing tracking
document.pdf
Debug ModeBooleanDebugging Control
• Enable detailed logging and debugging information
• Useful for troubleshooting HTML rendering issues
• Default is false
false
Binary Data Output Name***StringBinary 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

ParameterTypeDescriptionExample
fileNameStringPDF4me 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 processesdocument_with_html_header_footer.pdf
fileSizeNumberPDF4me 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 automation125430
successBooleanPDF4me 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 workflowstrue
mimeTypeStringPDF4me 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 applicationsapplication/pdf
pageCountNumberPDF4me 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 progress5
messageStringPDF4me header/footer status message - Human-readable status message providing details about the header/footer addition process result. Includes success confirmation or error details for troubleshootingHTML 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 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
}
]

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

Step-by-step guides to add HTML headers and footers to PDFs:

Get Help