Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use wkhtmltopdf’s --header.left, --header.center, and --header.right options for a simple repeating header; use the corresponding --footer.* options for footer text. For more control over layout, supply an HTML document with the header or footer HTML URL setting. Set page margins and header/footer spacing separately, then check the generated PDF for overlap or clipping.

Choose text options or an HTML document

wkhtmltopdf provides two approaches. Positional text settings suit a short title, date, or other text aligned left, center, or right. A separate HTML document is available when you need more control over the header or footer’s markup and layout. The project documents both approaches but does not claim that one is universally better. Consider how complex the content is and how easy the markup will be to maintain. See the settings reference and the HeaderFooter API reference.

Add a simple text header or footer

The command-line options correspond to settings documented by the project: header or footer content can be placed at the left, center, and right. Put the options before the input page and output filename. For example, the following shows the option arrangement for a header; replace the illustrative values and filenames with your own:

wkhtmltopdf --header.left "Quarterly report" --header.center "Example date" --header.right "Page" input.html output.pdf

For a footer, use the footer equivalents:

wkhtmltopdf --footer.left "Quarterly report" --footer.center "Example date" --footer.right "Page" input.html output.pdf

These are command-line examples of the documented setting families, not a guarantee that the literal word “Page” will be replaced with a page number. For exact option spelling and supported values in your installation, check wkhtmltopdf --help or the manual for that installed version.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use a separate HTML header or footer

For a designed banner or content that does not fit the positional text fields, use the documented header.htmlUrl setting or its footer counterpart to provide an HTML document. The API reference describes the HTML document URL alongside the text and spacing fields. Check your installed command’s help for the precise command-line form of the HTML URL option; the official settings pages document the setting, but do not establish a complete CLI invocation here.

Keep the markup maintainable and account for the available page area. A separate HTML file gives you a place to structure more elaborate content, while positional fields are simpler for short text.

Set margins and header/footer spacing

Page margins and header/footer spacing are separate settings. The project documents margin.top and margin.bottom as page settings, and header/footer spacing as its own control. If a header is pushed beyond the page, the settings reference warns that excessive spacing can cause this; increasing the top margin can correct it. Apply the same practical check to footer clearance, but verify the PDF produced by your build rather than assuming identical behavior in every version.

Rank #2
Sale
HTML and CSS: Design and Build Websites
  • HTML CSS Design and Build Web Sites
  • Comes with secure packaging
  • It can be a gift option
  • Increase the top margin if the header is clipped or sits outside the page.
  • Adjust the header spacing independently, and inspect the PDF after each change.
  • For a footer that overlaps page content or is clipped, review the bottom margin and footer spacing together.

Page numbers and offsets

The global pageOffset setting adds a number to page numbers used in headers, footers, and the table of contents. The settings reference points to the manual for the substitution sequences used to insert page-number values, but its cited material does not expose the complete token list. Do not assume a token from another version will work: identify your installed wkhtmltopdf version and confirm its supported substitution syntax with its help output or manual.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Troubleshoot common output problems

Header or footer is missing

  • Confirm that you used the header options for a top header and footer options for a bottom footer.
  • Check the option spelling and placement with wkhtmltopdf --help for your installed build.
  • If using an HTML document, verify that the configured URL points to the intended document and is accessible to the process generating the PDF.

Text is clipped or overlaps page content

  • Adjust the relevant page margin and the header/footer spacing as separate values.
  • Regenerate and inspect the PDF after each adjustment; spacing can move a header beyond the page.

Page numbers are not substituted

Check the installed version’s manual or help output for the supported substitution sequences. The project’s settings reference documents pageOffset, but does not provide a complete token list in the cited material.

Version and security considerations

The wkhtmltopdf downloads page identifies 0.12.6 as the stable series and gives its release date as June 11, 2020. That is the project’s stated release information, not confirmation that a particular platform or installation uses that version or is compatible with it. Check your own installed version and platform before relying on version-specific behavior. The project describes wkhtmltopdf as an open-source command-line tool that renders HTML to PDF using the Qt WebKit rendering engine; see the project overview.

The project’s downloads page warns: “Do not use wkhtmltopdf with any untrusted HTML – be sure to sanitize any user-supplied HTML/JS, otherwise it can lead to complete takeover of the server it is running on!” Treat this as a security boundary when accepting HTML or JavaScript from users; consult the official downloads page.

Rank #4
Sale
Web Design with HTML, CSS, JavaScript and jQuery Set
  • Brand: Wiley
  • Set of 2 Volumes
  • A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If what you need is a website screenshot or PDF rather than a wkhtmltopdf header/footer configuration, ScreenshotNeo provides a website screenshot API and MCP server. Its API returns a screenshot or PDF from a GET request; it is not a drop-in setting for adding custom wkhtmltopdf headers or footers.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Example request, adapted to capture a page as WebP:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo API documentation for setup and options. ScreenshotNeo removes cookie banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, and failed loads are never billed. Its MCP server lets AI agents take screenshots. The free plan includes 1,000 screenshots a month with no card, and paid plans start at $5 for 3,000. Sign up for the free plan.

Frequently Asked Questions

Where can I check the exact header and footer option syntax?

Run wkhtmltopdf --help or consult the manual for the version installed on your system.

Does pageOffset itself insert a page-number token?

No. The settings reference describes pageOffset as an added number for numbering used in headers, footers, and the table of contents. Check your installed version’s manual for the substitution sequences.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.