Use --javascript-delay for a fixed wait, or --window-status when your page can signal that rendering is complete. wkhtmltopdf enables JavaScript by default, but its documented post-load delay is only 200 milliseconds—often too short for data fetched asynchronously. A reliable PDF workflow therefore combines an explicit readiness strategy, a verified wkhtmltopdf build, and a fallback plan for pages that require a modern browser engine.
Choose the right wait strategy
wkhtmltopdf starts JavaScript unless you disable it. The important question is when conversion should begin. There are two documented ways to wait:
| Method | How it works | Best use | Main limitation |
|---|---|---|---|
--javascript-delay <msec> |
Pauses for a fixed number of milliseconds after page loading. | Pages with predictable rendering time that you do not control. | A single delay can be too short on a slow run and waste time on a fast run. |
--window-status <value> |
Waits until the page sets window.status to the specified value. |
Applications where you control the HTML and can define a readiness signal. | The page must set the value on every success path; the manual does not define a universal timeout policy. |
Use a delay as a timing buffer, not proof that data is ready. A status value is generally more deterministic because the page announces completion after its asynchronous work and layout changes finish.
Check your wkhtmltopdf build first
- Run
wkhtmltopdf --version. - Run
wkhtmltopdf --helpand confirm that the options you need are listed. - Record whether the binary is a patched-Qt build or a distribution package. Features can differ when a package was compiled without wkhtmltopdf’s Qt patches.
The project’s downloads page identifies 0.12.6 as its stable series and dates that release to June 11, 2020. That is a release fact, not a guarantee that no newer build exists; always inspect the executable installed in your deployment environment.
#1 Best Overall
- INNOVATIVE CARTRIDGE-FREE PRINTING — No more dealing with lots of tiny ink cartridges; With this wireless document and photo printer each ink bottle set is equivalent to about 90 individual cartridges²
- LESS FREQUENT INK REPLACEMENT — Replacement ink bottles don't have to be changed nearly as often as ink cartridges¹; When you choose this combination printer, scanner and copier you can print up to 4,500 pages black/7,500 color³
- COLOR PRINTING — Up to 2 years of ink in the box4 (and with every replacement ink set) for fewer out-of-ink frustrations
- ZERO CARTRIDGE WASTE — By using an Epson EcoTank printer you can help reduce the amount of cartridge waste ending up in landfills
- HOME PRINTER DESIGNED FOR RELIABILITY — The Epson EcoTank ET-2800 All-in-One Supertank Color Printer creates vivid, detailed prints and documents thanks to Micro Piezo Heat-Free Technology; Fire off 10 ISO pages per minute1 to easily finish large jobs
Method 1: wait a fixed number of milliseconds
Basic command
wkhtmltopdf --enable-javascript --javascript-delay 3000 https://example.com report.pdf
--enable-javascript makes the intent explicit, although JavaScript is enabled by default. The example waits three seconds. Choose the value from measurements of your real page, network, and data source; there is no delay that is reliable for every application.
Render a local HTML file
wkhtmltopdf --enable-javascript --javascript-delay 2000 file:///absolute/path/report.html report.pdf
Use an absolute file:// URL. If the document loads scripts, fonts, images, or data from another origin, check that those resources are reachable from the conversion host and permitted by the page’s security policy.
How to tune the delay
- Capture a baseline with the documented 200 ms default.
- Inspect the PDF for missing charts, empty data regions, or layout that changes after the intended point.
- Increase the delay in measured increments and repeat under representative load, including a slower network or cold application start.
- Stop increasing it when the page is consistently complete, or move to a page-owned readiness signal.
Long waits increase latency for every conversion and still cannot guarantee completion when a request fails or a script hangs. A delay also does not add browser capabilities that the bundled rendering engine lacks.
Method 2: wait for a page-owned readiness signal
If you control the page, set a known status only after every element required in the PDF has been populated and any chart, image, or layout adjustment has finished.
Example page code
<script>
(async () => {
try {
const response = await fetch('/api/report');
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const data = await response.json();
renderReport(data);
await document.fonts.ready;
window.status = 'pdf-ready';
} catch (error) {
console.error(error);
window.status = 'pdf-error';
}
})();
</script>
Set the value after the final DOM update, not merely after the first fetch. If the page uses several asynchronous operations, wait for all of them. Set an explicit error value in failure handling so your caller can detect a failed render instead of waiting indefinitely.
wkhtmltopdf command
wkhtmltopdf --enable-javascript --window-status pdf-ready https://example.com/report report.pdf
The option waits for equality with the supplied status value. Because the manual does not specify a universal timeout strategy for this wait, enforce an outer timeout in your job runner or process supervisor and collect logs when a page never reaches either status.
Inject code with --run-script
--run-script runs JavaScript after page loading. It is useful for a small, controlled adjustment—for example, clicking a tab or setting a page variable—before conversion.
Rank #2
- CARTRIDGE-FREE PRINTING — Print lab-quality photos, graphics and creative projects; Get vibrant colors and sharp text with Epson's high-accuracy printhead and Claria ET Premium 6-color inks
- INK BOTTLES — Save on photos1 and creative projects with affordable in-house printing; All-in-one printer allows you to print 4" x 6" photos for about 4 cents each vs. 40 cents with traditional ink cartridges1
- LESS FREQUENT INK REPLACEMENT — Replacement ink bottles don't have to be changed nearly as often as ink cartridges¹; Printer, scanner and copier lets you print up to 6,200 color pages³
- PRINT FOR LONGER — Up to 2 years of ink in the box² (and with every replacement ink set) for fewer out-of-ink frustrations with this wireless printer
- ZERO CARTRIDGE WASTE — Epson EcoTank printer helps reduce the amount of cartridge waste ending up in landfills; Cartridge-free printer uses high-yield ink bottles; Each replacement ink bottle set is equivalent to about 100 individual ink cartridges⁴
wkhtmltopdf --enable-javascript
--run-script "document.body.classList.add('print-mode');"
--javascript-delay 1000
https://example.com report.pdf
Injection is not a replacement for compatibility. If the site depends on browser APIs unavailable to wkhtmltopdf’s older WebKit, additional script cannot make those APIs appear.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchMake the page deterministic for PDF output
Wait for the actual content
- Use an application-level promise that resolves after data, charts, and images are rendered.
- Wait for fonts when text metrics affect line wrapping or pagination.
- Set the readiness marker after layout-affecting operations, not before.
- Ensure success and failure paths both update a status value.
Separate screen and print presentation
Use print-specific CSS to remove controls, constrain animation, and prevent transitions from being captured midway. Disable auto-rotating carousels and other time-dependent behavior during the PDF render. If a third-party widget is optional, hide it before declaring the page ready.
Control external dependencies
Network calls, authentication, rate limits, and blocked mixed content can leave a page visually incomplete. Reproduce the conversion from the same host, with the same cookies and headers, and log failed requests in the application. A longer JavaScript delay cannot repair a request that never succeeds.
When wkhtmltopdf cannot render the page
wkhtmltopdf’s project status records that Qt 4 has been unsupported since 2015 and that its WebKit had not been updated since 2012. For modern applications using newer JavaScript or browser APIs, a missing feature—not timing—is often the cause of a blank or partially rendered PDF.
The project recommends Puppeteer for sites with dynamic JavaScript. Puppeteer’s Page.pdf API uses a current browser page and is the direct alternative when compatibility is the problem. For reports generated from HTML you control, the same project status also suggests evaluating WeasyPrint or commercial Prince.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Clear out junk files and repair common Windows errors3Fix the driver behind crashes, sound loss and screen glitchesMinimal Puppeteer example
import puppeteer from 'puppeteer';
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('https://example.com/report', { waitUntil: 'networkidle0' });
await page.pdf({ path: 'report.pdf', format: 'A4', printBackground: true });
await browser.close();
This approach changes the renderer rather than trying to extend wkhtmltopdf’s old engine. Choose it when your page requires modern APIs, reliable network-idle behavior, or browser-level control.
Security and deployment precautions
The wkhtmltopdf project explicitly warns against using the tool with untrusted HTML and JavaScript. Sanitize user-supplied HTML and scripts before conversion, and consider operating-system containment such as AppArmor or SELinux. These measures are recommendations, not a complete security architecture.
Rank #3
- SET IT UP ONCE AND PRINT WITH CONFIDENCE. No complicated maintenance. Just easy, reliable printing you can count on.
- INK FOR YEARS. NOT MONTHS. Up to 2 years of ink included. Get thousands of pages of cartridge-free printing. More pages, less hassle
- KEEPS PRINTING WELL AFTER COMPETITORS HAVE QUIT. No complex maintenance. Sharper text, richer colors.[2] Only with HP Smart Tank
- PREMIUM SUPPORT - Strong technical expertise to solve issues faster
- THE LAST PRINTER YOU'LL EVER NEED. Enjoy years of refillable, cartridge-free printing.
- Run conversions as a low-privilege user.
- Restrict outbound network access where business requirements allow.
- Apply process, memory, and wall-clock limits.
- Keep temporary files isolated and remove them after conversion.
- Do not pass attacker-controlled command-line fragments through a shell.
Troubleshooting common failures
The PDF contains an empty chart or loading spinner
Cause: the default 200 ms wait ended before asynchronous rendering. Fix: measure the page and use --javascript-delay, or add a window.status signal after the chart is complete.
The status-based conversion never finishes
Cause: the page never assigns the exact value, assigns it before an awaited operation finishes, or throws before the assignment. Fix: verify spelling and case, set a failure status in catch, and enforce an outer job timeout.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →More delay does not change the output
Cause: an unsupported browser API, failed network request, authentication problem, or JavaScript exception. Inspect browser-console and application logs, test the URL from the conversion host, and compare the required API with wkhtmltopdf’s older WebKit. Move to Puppeteer when compatibility is the limiting factor.
The command works locally but not in production
Cause: different executable builds, missing patched-Qt features, fonts, certificates, permissions, or network access. Compare wkhtmltopdf --version, package provenance, installed fonts, and outbound connectivity in both environments.
Injected JavaScript has no visible effect
Cause: the script runs after load but before a later framework update, targets the wrong selector, or depends on APIs unavailable in the renderer. Use a page-owned readiness flow where possible and verify the DOM state immediately before conversion.
Performance, reliability, and cost decisions
- Fixed delay: simplest integration, but latency grows with the safety margin and reliability varies with runtime conditions.
- Status signal: avoids unnecessary waiting when correctly implemented, but requires page changes and a timeout policy outside wkhtmltopdf.
- Puppeteer: better fit for modern JavaScript, with a browser process and its operational overhead.
- WeasyPrint or Prince: worth evaluating for controlled report HTML when a browser is unnecessary; feature coverage differs from a JavaScript-capable browser.
Measure conversion duration, timeout rate, missing-content rate, and output size on representative pages. Include cold starts and slow data responses in acceptance tests. A PDF that completes quickly but omits data is not a successful conversion.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Or skip the browser setup
For a screenshot or PDF of a web page without maintaining a rendering process, ScreenshotNeo accepts one request and returns PNG, JPEG, WebP, or PDF. It accepts cookie and consent banners like a visitor, then removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each cleanup step can be disabled. Only clean shots are billed: bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers identify the page verdict and billing result.
It also provides an MCP server for Claude, Cursor, and other MCP clients, with take_screenshot, get_page_info, and capture_pdf tools. Features include full-page capture with lazy images loaded, CSS-selector element capture, dark mode, device presets and custom viewports, retina scale, PDF paper size/margins/orientation/page ranges, custom CSS and JavaScript, clicks, selector waits, delays, network-idle waits, request blocking, headers, cookies, user agents, authorization, timezone, geolocation, transparent backgrounds, resizing, configurable-TTL caching, signed links, asynchronous jobs with signed webhooks, bulk capture of up to 100 URLs per call, a usage API, and an OpenAPI specification.
Rank #4
- Wireless Bluetooth Printer: Portable thermal printer compatible with iPhone, Android phones, iPad and tablet computers via Bluetooth. For smartphones, please download the "Nada Print" App. You can also connect to laptops and computers for printing using a USB-C cable. (Note: Laptops and computers can only be connected via USB and require the installation of a driver first. Bluetooth connection is not supported.)
- No-ink printing: Only supports US Letter and A4 size thermal paper.(Doesn't support regular paper) The no-ink portable thermal printer uses direct thermal technology, requiring no ink, toner or ribbons, making it environmentally friendly, cost-effective and time-saving. The thermal printer package comes with a roll of US Letter thermal printing paper. Note: When installing the paper, remember to switch the paper size switch on APP
- Clear Print: NDYIN N80 portable thermal printer adopts high-definition printing technology, with a 203DPI resolution to provide you with clear printing results. This mobile printer is compatible with roll paper, folded paper and tattoo transfer paper, supporting printing from your mobile phone PDF, Word, pictures and web pages anytime and anywhere. It is recommended to use our NDYIN thermal paper to achieve good printing quality
- Portable wireless printer for travel: The thermal printer is equipped with a built-in 1500mAh rechargeable battery, which can print 160 sheets of 8.5" x 11" thermal paper after being fully charged. It weighs only 1.5 pounds and is compact in size. This ink-free portable printer can be easily carried in a backpack or briefcase! It is perfect for business travel, cars, small offices, construction sites, schools and homes. You can print documents, contracts, invoices and boarding passes anytime and anywhere
- The N80 thermal printer has a wide range of uses. The package includes the N80 printer, a roll of US Letter paper(7m/roll), a user manual, a guide card, a type-C soft cable and a type C adapter. Note: The charging adapter is not included. Special thermal paper is required for use; ordinary paper cannot be used. This ink-free portable thermal printer is suitable for various scenarios such as home, school, travel, office, and outdoor, meeting the printing needs of different groups of people. This tattoo template printer is also compatible with tattoo transfer paper, making it an ideal choice for tattoo art
See the ScreenshotNeo documentation for request options. A direct PDF request can use the same endpoint:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
For PDF output, supply the PDF option documented for the endpoint and choose a PDF filename. The equivalent Python and Node.js request forms are:
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →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)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
The Free plan includes 1,000 shots each month with no card. Paid plans start at $5 for 3,000 shots; every feature is available on every plan. Create a free ScreenshotNeo account.
FAQ
Is JavaScript enabled by default in wkhtmltopdf?
Yes. The documented default enables JavaScript; you can still pass --enable-javascript to make the command explicit.
Can I use both --javascript-delay and --window-status?
They represent different readiness controls. Use the one that matches your page and test the resulting behavior; a delay should not be treated as a substitute for a correct page-owned signal.
What does --run-script solve?
It injects additional JavaScript after page loading. It can alter a controlled page, but it cannot add modern browser APIs that wkhtmltopdf’s rendering engine does not support.
Frequently Asked Questions
Is JavaScript enabled by default in wkhtmltopdf?
Yes. The documented default enables JavaScript; you can still pass --enable-javascript to make the command explicit.
Can I use both --javascript-delay and --window-status?
They represent different readiness controls. Use the one that matches your page and test the resulting behavior; a delay should not be treated as a substitute for a correct page-owned signal.
What does --run-script solve?
It injects additional JavaScript after page loading. It can alter a controlled page, but it cannot add modern browser APIs that wkhtmltopdf’s rendering engine does not support.
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.
Free tools Windows power users keep installed
One-click scans. No signup required.




