What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
If wkhtmltopdf creates a PDF but the content from --header-html is missing, troubleshoot it in two stages: first prove that wkhtmltopdf can load the header file, then make room for the rendered header. Use a complete HTML document, pass an absolute path or verified URL, reserve space with --margin-top, and tune --header-spacing. Only add page-number JavaScript after static header text appears.
What usually causes a missing header
A missing header is not one single bug. The header can disappear because the external document was never loaded, because the page geometry leaves no room for it, or because the header document is malformed or relies on resources that the converter cannot access. Historical reports involve wkhtmltopdf 0.12.0 and 0.12.5 on both Windows and Ubuntu, so behavior can vary by build and operating system.
- Loading failure: the path,
file:///URL, permissions, local-file policy, or remote URL is wrong. Conversion may continue while printing a warning to stderr. - Insufficient top margin: a header can load correctly but be hidden or clipped when
--margin-topis zero or smaller than the rendered header. - Spacing pushed it away: an excessive
--header-spacingvalue can move the header outside the printable page area. - Document or script issue: an incomplete header document, unavailable CSS or images, or JavaScript added before static content was verified can make diagnosis harder.
Keep those failure stages separate. If the static words never appear, changing CSS will not repair a file-loading problem. If they appear but overlap the body, the file is loading and the remaining work is layout.
Build a minimal, valid header document
Start with a separate file named header.html. Use a doctype, an HTML element, a head, a character set, and a body. A field report from Aaron C. specifically recommends a doctype, even a basic <!DOCTYPE html>; treat that as a practical compatibility measure rather than a guarantee for every build.
#1 Best Overall
- Create a mix using audio, music and voice tracks and recordings.
- Customize your tracks with amazing effects and helpful editing tools.
- Use tools like the Beat Maker and Midi Creator.
- Work efficiently by using Bookmarks and tools like Effect Chain, which allow you to apply multiple effects at a time
- Use one of the many other NCH multimedia applications that are integrated with MixPad.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Header</title>
<style>
body { margin: 0; font: 10pt Arial, sans-serif; }
.header { border-bottom: 1px solid #999; padding-bottom: 3mm; }
</style>
</head>
<body>
<div class="header">Test header</div>
</body>
</html>
Do not begin with a fragment such as <div>Header</div> when diagnosing the problem. A complete document removes one variable. Keep the first version static: no external fonts, images, frameworks, or page-number script.
Pass the file and reserve page space
Use an absolute filesystem path where possible. The following command gives the header 25 mm of top space and places it 3 mm above the document body.
wkhtmltopdf --margin-top 25mm --header-spacing 3 --header-html /absolute/path/header.html input.html output.pdf
On Windows, quote a path containing spaces, for example:
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →wkhtmltopdf --margin-top 25mm --header-spacing 3 --header-html "C:reportsheader.html" "C:reportsinput.html" "C:reportsoutput.pdf"
Choose the margin from the actual rendered height. A one-line header may need less than 25 mm; a logo, two lines of text, or a table may need more. The margin is the reserved band at the top of every page, while spacing is the gap between the header and the body. If the header is clipped, increase the margin first. If the header is visible but too close to the body, increase spacing in small increments. If a large spacing value makes the header vanish, reduce it.
Rank #2
Verify that wkhtmltopdf can load the header
Use stderr as a loading test
Run the command from a terminal and read stderr, not just the generated PDF. Messages such as “Failed loading page” or an HTTP error indicate that the external document was not loaded. A conversion that exits with a PDF does not prove that every auxiliary document succeeded.
wkhtmltopdf --margin-top 25mm --header-spacing 3 --header-html /absolute/path/header.html input.html output.pdf 2> wkhtmltopdf.log
cat wkhtmltopdf.log
On Windows PowerShell, capture diagnostics with:
wkhtmltopdf --margin-top 25mm --header-spacing 3 --header-html "C:reportsheader.html" "C:reportsinput.html" "C:reportsoutput.pdf" 2> .wkhtmltopdf.log
Get-Content .wkhtmltopdf.log
Check the path and file permissions
- Confirm the file exists at the exact path visible to the wkhtmltopdf process, not merely in your editor.
- Use an absolute path while testing; relative paths depend on the process working directory.
- Ensure the account running a web server, queue worker, container, or service can read the file.
- When using a URL, open that exact URL from the same machine and verify its HTTP status, redirects, authentication, and TLS certificate.
- For local files, test the path form accepted by your build. Some reports show failures with
file:///header URLs, while a direct filesystem path works.
If your package applies local-file restrictions, review its local-resource settings and only relax them when the files are trusted. Do not treat a security-policy change as a substitute for correcting a bad path.
Add dynamic page values only after static text works
wkhtmltopdf’s HTML header mode supports values such as [page], [topage], [sitepage], and [doctitle]. The documented pattern is to read query-string values in JavaScript and replace matching elements. First confirm a static header, then add one value at a time.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>body { margin: 0; font: 9pt Arial; } .row { display: flex; justify-content: space-between; }</style>
</head>
<body>
<div class="row">
<span>Monthly report</span>
<span>Page <span id="page"></span> of <span id="topage"></span></span>
</div>
<script>
function query(name) {
var match = new RegExp('[?&]' + name + '=([^&]*)').exec(window.location.search);
return match ? decodeURIComponent(match[1].replace(/\+/g, ' ')) : '';
}
document.getElementById('page').textContent = query('page');
document.getElementById('topage').textContent = query('topage');
</script>
</body>
</html>
JavaScript support and timing can differ between package builds. Keep the script small, avoid asynchronous work, and do not use it to hide a loading problem. If the static label renders but the number does not, inspect the query-string parsing and the build’s JavaScript behavior separately.
Rank #3
- Intuitive interface of a conventional FTP client
- Easy and Reliable FTP Site Maintenance.
- FTP Automation and Synchronization
Diagnose clipping, overlap, and excess whitespace
Header is present but clipped
Increase --margin-top until the complete header fits. Check the header’s own body margin, line height, image dimensions, and borders. A CSS margin on the first child can also consume space unexpectedly; set the header document’s body margin explicitly.
Header overlaps the document
Increase the top margin or reduce the header’s rendered height. The body document’s padding does not replace wkhtmltopdf’s reserved margin. Keep --header-spacing modest and adjust it only after the margin is sufficient.
Large blank area appears above the body
Reduce an oversized top margin or spacing value in measured steps. Reports associated with issue #3974 describe excess whitespace after header changes and recommend setting margins deliberately rather than relying on defaults.
Free tools Windows power users keep installed
One-click scans. No signup required.
Header appears on some pages but not others
Check whether the content is being converted as one document and whether the header depends on page-specific script values. Test a static header across a two-page input. If static output is consistent, reintroduce dynamic code and external resources incrementally.
Rank #4
- Full-featured professional audio and music editor that lets you record and edit music, voice and other audio recordings
- Add effects like echo, amplification, noise reduction, normalize, equalizer, envelope, reverb, echo, reverse and more
- Supports all popular audio formats including, wav, mp3, vox, gsm, wma, real audio, au, aif, flac, ogg and more
- Sound editing functions include cut, copy, paste, delete, insert, silence, auto-trim and more
- Integrated VST plugin support gives professionals access to thousands of additional tools and effects
Use a controlled troubleshooting sequence
- Record the exact
wkhtmltopdf --versionoutput, operating system, installation source, and the command line. - Create the minimal
header.htmlshown above. - Convert a tiny local input with an absolute header path and
--margin-top 25mm --header-spacing 3. - Capture stderr and resolve every path, permission, URL, or HTTP warning.
- Open the PDF and classify the result: absent means loading or document structure; clipped or overlapping means geometry.
- Adjust margin and spacing based on the measured header height.
- Add CSS, images, and external resources one at a time. Re-test after each addition.
- Add page substitutions such as
[page]and[topage]last. - Repeat the minimal test in the production account, container, or worker. A file readable by your shell user may be inaccessible to the service account.
Reliability and deployment considerations
Pin and record the wkhtmltopdf build used for production PDFs; historical issue reports demonstrate that version and platform matter. Keep header assets local and lightweight when reproducibility is important. If the header uses a remote stylesheet, image, or font, a network failure can change its height or appearance even when the HTML file itself loads.
For automated jobs, save stderr with the job identifier, preserve the exact input and header files for failed conversions, and verify that the output PDF contains the expected text before publishing it. A successful process exit is not a visual assertion. Run a two-page regression fixture whenever you change margins, package versions, or the header template.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Or skip the browser setup
If your real goal is a clean website image or PDF rather than a wkhtmltopdf header, ScreenshotNeo provides a single HTTP request. It accepts cookie and consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be turned off. Only clean shots are billed: bot checks, CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and the response identifies the result with X-Page-Verdict and X-Billed headers. Its MCP server exposes take_screenshot, get_page_info, and capture_pdf to Claude, Cursor, and other MCP clients.
Here is the one-call cURL example (see the ScreenshotNeo documentation for all options):
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
Python
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
Node.js
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
ScreenshotNeo also supports full-page capture with lazy images loaded, CSS-element capture, dark mode, 12 device presets and custom viewports, retina scale, PDF paper settings and page ranges, custom CSS and JavaScript, clicks, waits, request blocking, headers, cookies, user agents, authorization, timezone, geolocation, transparent backgrounds, resizing, selectable cache TTLs, signed image links, asynchronous webhooks, bulk capture of up to 100 URLs per call, a usage API, and an OpenAPI specification. Its parameter names are compatible with those used by other screenshot APIs, which can simplify migration.
Best Value
- Mix an audio, music and voice tracks
- Record single or multiple tracks simultaneously
- Intuitive tools to split, trim, join, and many other editing features
- Loaded with audio effects including EQ, compression, reverb, and more.
- Load an audio file and export to all popular audio formats from studio quality wav to high compression formats
The Free plan includes 1,000 screenshots per month with no card. Paid plans start at $5 for 3,000 shots; yearly billing gives two months free, and every feature is available on every plan. Create a free ScreenshotNeo account to try it.
Frequently asked questions
Does --header-html accept a fragment?
Use a complete HTML document while troubleshooting. It gives wkhtmltopdf a doctype, head, and body and removes ambiguity about parsing and styles.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Why does conversion succeed when the header failed?
wkhtmltopdf can continue producing the main PDF after an auxiliary header URL reports a loading error. Always inspect stderr and test the exact header path independently.
Which should I change first, margin or spacing?
Set a sufficient top margin for the header’s full height first. Use spacing afterward to control the gap between header and body.
Are page numbers automatic?
The header mechanism exposes values including [page] and [topage], but your header document must read and display those query-string values.
Quick Recap
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.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problems

