October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk4 min

How to Make wkhtmltopdf Wait for JavaScript to Finish Loading

Make wkhtmltopdf wait for dynamic page content with an explicit window.status marker or a fixed JavaScript delay, and learn the limits of each approach.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use --window-status when your page can signal that its required asynchronous content is ready: set window.status to a distinctive value after rendering, then tell wkhtmltopdf to wait for that value. For a simpler, approximate pause, use --javascript-delay with a duration in milliseconds. JavaScript is enabled by default in the documented command-line tool.

Choose a readiness strategy

Option What triggers PDF rendering Best for Important limitation
--window-status <value> window.status equals the supplied value Pages you control that can mark readiness after their required asynchronous work The documentation does not specify a universal timeout if the value never appears.
--javascript-delay <msec> The configured time elapses after page load Pages whose rendering time is predictable enough for a bounded pause A delay is not proof that application work finished. Too short may capture incomplete content; too long wastes time.

The wkhtmltopdf usage documentation gives a default JavaScript delay of 200 ms. That is a default configuration value, not a guarantee that a particular page’s scripts or data requests will finish within that time. See the wkhtmltopdf usage documentation.

Wait for an explicit page-ready signal

If you can change the source page, set a distinctive status value only after the data and DOM updates needed in the PDF are complete. Then pass exactly the same value to --window-status.

<script>
  // Set this only after the asynchronous work required in the PDF is complete.
  window.status = 'pdf-ready';
</script>
wkhtmltopdf --window-status pdf-ready input.html output.pdf

Place the assignment at the real end of the work you need to capture—not simply in an early page-load handler if later requests or rendering steps still matter. If a script controls the asynchronous work, set the marker after it has updated the page.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
MixPad Free Multitrack Recording Studio and Music Mixing Software [Download]
  • 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.

Do not pass --disable-javascript when relying on page JavaScript to assign the status. The documented command-line tool enables JavaScript by default; disabling it prevents the page script from running.

Use a fixed delay when a signal is unavailable

For a page that you cannot modify, or one without a reliable readiness marker, specify an elapsed wait in milliseconds:

Rank #2
MixPad Multitrack Recording Software for Sound Mixing and Music Production Free [Mac Download]
  • 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
wkhtmltopdf --javascript-delay 2000 input.html output.pdf

This example waits 2,000 ms after page load. Choose a duration based on the page’s observed behavior and allow for normal variation. A fixed pause can reduce premature captures, but it cannot tell whether an application-specific request failed, took unusually long, or has not yet updated the DOM.

Library configuration

For the libwkhtmltox interface, the analogous setting is load.jsdelay, which controls waiting after page load. JavaScript enablement is configured with web.enableJavascript. The library documentation also describes printing when JavaScript calls window.print(); this is distinct from using a ready marker in the command-line interface. See the libwkhtmltox page settings reference.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
DeskFX Free Audio Effects & Audio Enhancer Software [PC Download]
  • Transform audio playing via your speakers and headphones
  • Improve sound quality by adjusting it with effects
  • Take control over the sound playing through audio hardware

Do not treat combined options as a universal contract

The official option descriptions do not establish how --javascript-delay and --window-status interact when used together, nor do they specify a universal timeout for an unmet status value. A historical report for wkhtmltopdf 0.12.2.1 says the reporter observed the longer wait when combining the options, but that observation is not a cross-version guarantee. Prefer one clear readiness strategy, then validate the exact binary and input page you deploy. See the historical issue report.

Likewise, --run-script runs extra JavaScript after the page is done loading, according to the usage documentation; it is not documented as waiting for your application’s asynchronous work to finish. See the usage reference.

Rank #4
Express Schedule Free Employee Scheduling Software [PC/Mac Download]
  • Simple shift planning via an easy drag & drop interface
  • Add time-off, sick leave, break entries and holidays
  • Email schedules directly to your employees

Troubleshoot waits that finish too early or never finish

  • The PDF misses dynamic content: A short fixed delay may have elapsed before rendering completed. Increase it with --javascript-delay, or use a page-controlled status marker set after the required data and DOM updates.
  • The command appears to wait indefinitely: Check that the page actually assigns the exact string passed to --window-status, and that JavaScript is enabled. The documentation does not promise a general timeout if the marker is never set.
  • The status option seems ignored: Record the exact wkhtmltopdf version and build, command and option placement, and whether the input contains a table of contents or multiple page objects. Historical issue reports describe context-sensitive outcomes, including a 0.12.3 setup involving a table-of-contents object; these reports identify things to check, not universal behavior. See the 0.12.2.1 report and 0.12.3 report.
  • The page marker appears but content is still absent: Move the assignment until after the specific asynchronous operation and DOM update required by the PDF. A marker set too early is a false readiness signal.
  • The delay works inconsistently: A fixed duration is sensitive to variation in page loading and rendering. Use an explicit status signal if you can add one; otherwise select a delay with margin based on the page’s observed behavior.

The wkhtmltopdf repository is archived, and the cited documentation and historical reports do not establish behavior for every executable or a currently supported release. Validate the command against the exact build and page structure you intend to use.

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 you need a screenshot or PDF without managing a local browser-rendering wait, ScreenshotNeo provides a website screenshot API and MCP server. Its API accepts one GET request for an image or PDF, and the API documentation is at screenshotneo.com/docs.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Free Fling File Transfer Software for Windows [PC Download]
  • Intuitive interface of a conventional FTP client
  • Easy and Reliable FTP Site Maintenance.
  • FTP Automation and Synchronization
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

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, and the free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000. Sign up for the free plan.

Frequently Asked Questions

What unit does –javascript-delay use?

Milliseconds.

Does wkhtmltopdf enable JavaScript by default?

Yes, in the documented command-line tool.

What if the page never sets the requested window.status value?

The documentation does not specify a universal timeout. Ensure the page assigns the exact value and validate behavior with your deployed executable.

Quick Recap

Bestseller No. 1
MixPad Free Multitrack Recording Studio and Music Mixing Software [Download]
MixPad Free Multitrack Recording Studio and Music Mixing Software [Download]
Create a mix using audio, music and voice tracks and recordings.; Customize your tracks with amazing effects and helpful editing tools.
Bestseller No. 2
MixPad Multitrack Recording Software for Sound Mixing and Music Production Free [Mac Download]
MixPad Multitrack Recording Software for Sound Mixing and Music Production Free [Mac Download]
Mix an audio, music and voice tracks; Record single or multiple tracks simultaneously; Intuitive tools to split, trim, join, and many other editing features
Bestseller No. 3
DeskFX Free Audio Effects & Audio Enhancer Software [PC Download]
DeskFX Free Audio Effects & Audio Enhancer Software [PC Download]
Transform audio playing via your speakers and headphones; Improve sound quality by adjusting it with effects
Bestseller No. 4
Express Schedule Free Employee Scheduling Software [PC/Mac Download]
Express Schedule Free Employee Scheduling Software [PC/Mac Download]
Simple shift planning via an easy drag & drop interface; Add time-off, sick leave, break entries and holidays
Bestseller No. 5
Free Fling File Transfer Software for Windows [PC Download]
Free Fling File Transfer Software for Windows [PC Download]
Intuitive interface of a conventional FTP client; Easy and Reliable FTP Site Maintenance.; FTP Automation and Synchronization

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

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

More from the Wire

  1. Shenzhen desk3 min
    HONOR Expands Beyond Smartphones With Humanoid Robot RevealHONOR said it unveiled its first humanoid robot at MWC 2026 and named shopping assistance, workplace inspections, and supportive companionship as intended uses. Later Robotics D1 claims and a reported…
  2. Cupertino desk5 min
    Apple Unveils AirPods Max 2: The Upgrade That Should Have Happened Years AgoAirPods Max 2 adds H2-powered audio features and Apple claims up to 1.5× more effective ANC, but its design, Smart Case, and 20-hour battery rating are unchanged. Wired lossless audio…
  3. Cupertino desk4 min
    Apple’s OLED Touch MacBooks Are Coming—but the Dynamic Island Is the Real GambleApple has not announced an OLED touchscreen MacBook, but reports point to high-end models arriving in late 2026 or early 2027. The reported Mac Dynamic Island could be useful, but…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.