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.

Related Blog Posts(1)

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.

ParameterRequiredWhat it doesExample
Input Data TypeRequiredChoose 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 FieldConditionalName 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 ContentConditionalBase64 encoded PDF document content. Shown when Input Data Type is Base64 String.UEsDBBQABgAI...
PDF URLConditionalURL to the PDF file to add HTML header/footer to. Shown when Input Data Type is URL.
HTML ContentRequiredHTML 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>
LocationRequiredLocation where to add the HTML content. Options: Header, Footer, Both. Default is `Header`.Header
PagesRequiredSpecify 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 PageRequiredWhether to skip adding HTML header/footer to the first page. Default is `No`.No
Margin Left (Px)RequiredLeft margin in pixels. Default is `20`.20
Margin Right (Px)RequiredRight margin in pixels. Default is `20`.20
Margin Top (Px)RequiredTop margin in pixels. Default is `50`.50
Margin Bottom (Px)RequiredBottom margin in pixels. Default is `50`.50
Output File NameOptionalName for the output PDF file with HTML header/footer. Default is `document_with_html_header_footer.pdf`.document_with_html_header_footer.pdf
Document NameOptionalName of the source PDF file for reference. Default is `document.pdf`.document.pdf
Binary Data Output NameOptionalCustom name for the binary data in n8n output. Default is `data`.data

Output​

Output Parameters​

FieldTypeWhat it contains
successBooleanTrue when the operation succeeded.
messageStringStatus message, `HTML header/footer added successfully`.
fileNameStringFile name of the resulting file.
mimeTypeStringMIME type of the resulting file, for example `application/pdf`.
fileSizeNumberSize of the resulting file in bytes.
originalDocNameStringName of the input PDF (for Base64 input, the Document Name field).
locationStringLocation that was used (Header, Footer or Both).
pagesStringPages value that was sent.
skipFirstPageStringSkip First Page value that was used.
marginsStringObject with the margins that were used: left, right, top, bottom.
dataBinaryThe 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 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

Get Help​