Add HTML Header Footer to PDF
Add HTML content as header or footer or both to PDF file.
Parameters for adding HTML header and footer to PDF documents.
- Method: POST
- Endpoint: /api/v2/AddHtmlHeaderFooter
File Content
The content of the input file
- File Namestring, Required
Name of the file.
- HTML Contentbase64, Required
Specify the HTML content that should be inserted into the header, the footer, or both sections of the web page.
- Locationstring, Required
This means the actual content written in HTML (e.g., text, images, links, scripts, etc.) that is displayed or used in a web page.
- Header
The < header > section usually appears at the top of a web page and often includes: - Website logo or title
- Navigation menu
- Introductory information
If content is located in the header, it is usually visible at the beginning of the page and can be repeated across pages (like in a site layout). - Footer
The < footer > section appears at the bottom of a web page and often contains: - Contact information
- Copyright notice
- Links to privacy policies or terms
- Social media links
If content is in the footer, it’s usually the last thing the user sees on the page. - Both
Sometimes content may appear in both the header and footer, depending on its purpose (e.g., a navigation menu at the top and repeated again at the bottom for convenience).
- Header
- Pagesstring, Required
- Specify page indices as comma-separated values or ranges to process (e.g. “0, 1, 2-” or “1, 2, 3-7”).
- If not specified, the default configuration processes all pages. The input must be in string format.
- Skip first Pageboolean, Required
- Selecting true will exclude the first page from processing or inclusion.
- Selecting false will include the first page along with the rest of the document.
- Margin Left (px)double, Required
Specify how much space (in pixels) should be added as a left margin to the element.
Example: 2.01
- Margin Right (px)double, Required
Specify the amount of space (in pixels) to add as a right margin to the element.
Example: 2.01
- Margin Top (px)double, Required
Specify how much vertical space (in pixels) should be added above the element.
Example: 3.01
- Margin Bottom (px)double, Required
Specify how much vertical space (in pixels) should be added below the element.
Example: 5.01
Output
Output parameters for the PDF document with HTML header and footer.
- File Contentbinary
Output file content from the PDF4me Connect
Header
Content-Type:application/json
Authorization: Please copy key from the link.
Payload
{
"docContent": "Please put PDF base64 content",
"docName": "output.pdf",
"htmlContent": "<div>header</div>",
"pages": "1",
"location": "Header",
"skipFirstPage": false,
"marginLeft": 2.01,
"marginRight": 2.01,
"marginTop": 3.01,
"marginBottom": 5.01
}
PDF4me api samples
- CSharp(C#)
- Java
- JavaScript
- Python
- Salesforce
- n8n
- Google Script
- AWS Lambda