Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallUse wkhtmltopdf --run-script 'your JavaScript here' input.html output.pdf. The option supplies JavaScript that wkhtmltopdf runs after the page has finished loading; it can be repeated to run more than one script. For example: wkhtmltopdf --run-script 'document.body.classList.add("ready")' https://example.com output.pdf. The command-line manual documents this behavior for wkhtmltopdf 0.12.6 with patched Qt. Read the manual.
What –run-script does, and where it goes
wkhtmltopdf converts an input object, such as a webpage or HTML file, into an output document. The --run-script <js> option provides additional JavaScript for the page. Put the option and its JavaScript argument before the input and output paths:
wkhtmltopdf [options] input.html output.pdf
For example, this command adds a class to the document body before rendering:
wkhtmltopdf --run-script 'document.body.classList.add("ready")' https://example.com output.pdf
#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
The shell quotes group the JavaScript into one argument; they are not part of the script. Adjust quoting if your script or shell requires it. This is a syntax example, not a claim that the conversion has been tested against that page.
The manual says JavaScript is enabled by default and that each --run-script is run after the page is done loading. The option is repeatable, so you can supply it more than once:
wkhtmltopdf --run-script 'document.body.classList.add("ready")' --run-script 'document.title = "Captured report"' input.html output.pdf
These scripts are passed as JavaScript text. The manual does not describe a form that takes a path to a JavaScript file, so do not assume that --run-script script.js loads a file. If you need to maintain a larger script, put its logic in the page or use a wrapper that reads the file and passes its contents as the option argument, taking care to quote and validate the resulting command safely.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Coordinate scripts with content that loads later
“Page done loading” is not the same as “all asynchronous work is finished.” A page can still fetch data, render content, or load images after its initial load event. The manual does not promise that --run-script waits for arbitrary asynchronous JavaScript started by the page or by the supplied script.
Wait for a readiness signal
For a page you control, arrange for the page to set window.status to a known value only after the content needed in the PDF is ready. Then ask wkhtmltopdf to wait for that value:
wkhtmltopdf --window-status report-ready input.html output.pdf
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⁴
The page must actually set window.status to report-ready; otherwise wkhtmltopdf may keep waiting. This is useful when readiness depends on a known application event, rather than a guessed number of seconds. The manual documents --window-status <windowStatus> as a wait control. See the option reference.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Use a fixed JavaScript delay when appropriate
If the page behavior is predictable but has no readiness signal, use --javascript-delay <msec> to allow time after loading. The 0.12.6 manual lists a default delay of 200 milliseconds. Set a value based on the work your page actually performs, then inspect the generated PDF; there is no universally correct delay for all sites.
A delay is a time allowance, not proof that a particular request or rendering operation completed. Making it longer can also make every conversion slower. Prefer a readiness signal when you can reliably define one.
Understand slow-script behavior
The manual says wkhtmltopdf stops slow scripts by default and documents --no-stop-slow-scripts to change that behavior. This setting is separate from deciding when the page is ready: disabling the stop behavior does not itself establish that the output contains all desired content. A script that loops indefinitely can also prevent useful progress, so use this option only when you understand why a legitimate script runs slowly.
Quoting JavaScript safely in a command
Shell quoting determines what reaches wkhtmltopdf. The single-quoted example works in common POSIX shells when the JavaScript contains no single quote. If the script contains a single quote, either change the JavaScript string delimiters or use shell-appropriate escaping. For example, this uses double quotes inside the JavaScript and single quotes around the whole argument:
--run-script 'document.querySelector("#status").textContent = "Ready"'
When building commands programmatically, avoid concatenating untrusted page content or user-supplied JavaScript into a shell command. Prefer a process API that passes arguments separately, and apply the security precautions below.
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.
Check your wkhtmltopdf build before relying on an option
The online generated manual identifies itself as wkhtmltopdf 0.12.6 with patched Qt. The project’s downloads page calls 0.12.6 the stable series and gives its release date as June 11, 2020. Builds distributed by operating systems may differ, and the project notes that platform builds can behave differently.
- Run
wkhtmltopdf --versionto identify the executable available on your system. - Run
wkhtmltopdf -Hand check whether your build lists--run-script,--javascript-delay, and--window-status. - Try a small conversion with a page you control and inspect the resulting PDF before deploying the command in a larger workflow.
The project says its generated manual corresponds to the help displayed by wkhtmltopdf -H. If the local help differs from the online manual, treat the local executable’s output as the relevant reference for that installation. Sources: project downloads and documentation index.
Recommended Free Tools
Security: do not render untrusted HTML or JavaScript casually
The wkhtmltopdf downloads page warns that untrusted HTML can be dangerous and says user-supplied HTML or JavaScript must be sanitized; otherwise, it can lead to complete takeover of the server running the converter. A PDF conversion process should not be treated as a safe sandbox merely because its output is a document. Read the project’s warning.
- Render only content you control or have properly sanitized.
- Do not pass arbitrary user-provided script text to
--run-script. - Run conversions with only the operating-system permissions and access the job needs, and isolate the process from sensitive files and services where possible.
- Keep command arguments separate when invoking wkhtmltopdf from application code; do not interpolate untrusted values into a shell command.
Troubleshooting missing or incorrect output
The script appears not to run
Check that JavaScript is not disabled by another option, that your installed build recognizes --run-script, and that the option appears before the input object. Test with a simple visible change, such as changing the page title or adding a class, rather than starting with a complex application script. Confirm the result by inspecting the PDF, not just the command’s exit behavior.
The PDF misses content created by JavaScript
The page may finish its initial load before the relevant asynchronous work completes. Use --window-status with a readiness value your page sets after rendering the content, or set a considered --javascript-delay and verify the output. Do not assume that adding --run-script causes all page scripts or network activity to finish.
The command reports an option or argument error
Check the local wkhtmltopdf -H output, the order of the option and its argument, and shell quoting. The JavaScript must arrive as one argument. If using a wrapper or application, inspect how it splits and escapes arguments rather than adding more quote characters blindly.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →A script runs too long or the conversion stalls
Look for scripts that wait forever for an event or continually schedule more work. Confirm that any window.status readiness value can actually be reached. The manual documents stopping slow scripts as the default and provides --no-stop-slow-scripts; changing that behavior is not a general remedy for an application that never reaches a stable state.
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
Results differ from another machine
Compare --version and -H output on both systems. The online manual covers 0.12.6 with patched Qt, while the project cautions that platform builds can behave differently. Do not assume that a command verified for one packaged build behaves identically on another.
When wkhtmltopdf may not be the right renderer
The wkhtmltopdf project describes its Qt/WebKit foundation as outdated. For a site that depends on dynamic JavaScript, the project suggests considering Puppeteer. For generating reports from HTML you control, it also names WeasyPrint and commercial Prince as alternatives. These are the project’s recommendations, not results from a comparative test. See the project status page for its context.
If your requirement is to capture a page as an image or PDF through an API rather than manage a local HTML-to-PDF process, ScreenshotNeo is a separate option: it accepts a URL and returns PNG, JPEG, WebP, or PDF. It does not make wkhtmltopdf’s JavaScript execution more reliable; it is an alternative capture workflow.
Or skip the browser setup
ScreenshotNeo lets you request a screenshot or PDF with one HTTP call. For example, save a PDF using cURL:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o page.pdf
Replace YOUR_API_KEY with your key. See the ScreenshotNeo API documentation for request options and response details. The same endpoint supports PNG, JPEG, and WebP as well as PDF.
- Before capture, ScreenshotNeo accepts the cookie or consent banner like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be turned off.
- Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing. Responses include
X-Page-VerdictandX-Billedheaders. - An MCP server provides
take_screenshot,get_page_info, andcapture_pdftools for AI agents, including Claude, Cursor, and other MCP clients. - The Free plan includes 1,000 screenshots per month with no card required; paid plans start at $5 for 3,000 shots. Every feature is available on every plan.
Sign up for ScreenshotNeo’s free plan to get 1,000 screenshots a month with no card.
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.




