Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →To include an SVG that a page creates after an AJAX request, make wkhtmltopdf wait until the page has actually finished creating it. If you can change the page, set a unique window.status value after the data has arrived and the SVG is rendered, then pass that value with --window-status. If you cannot change the page, use --javascript-delay as a timing-based fallback and verify the result. JavaScript is enabled by default, but that does not guarantee a particular application or chart library will run correctly in the installed Qt WebKit-based build.
What wkhtmltopdf needs to capture
wkhtmltopdf turns an HTML page or URL into a PDF using Qt WebKit. For an AJAX-generated graphic, the important distinction is between the initial page load and the later work that fetches data and builds the SVG. The converter needs to render after that later work completes, with the SVG and its dependent resources available.
This workflow is about rendering SVG content inside an HTML page into PDF pages. It is not about exporting a webpage’s SVG as a standalone .svg file. A third-party project named wkhtmltopdf-svg describes that separate export purpose; it is not a requirement for rendering inline SVG into a PDF with the regular command-line tool.
The wkhtmltopdf manual documents JavaScript as enabled by default and documents two ways to wait: a fixed delay and a page-defined status value. Neither setting by itself proves that arbitrary modern JavaScript, every SVG feature, or every chart framework will work with a given build. Validate the actual page and binary you intend to use.
Outdated 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 matchPC 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 & 11#1 Best Overall
Best option: signal that the AJAX and SVG work is complete
If you control the page, set window.status to a distinctive value only after the request has succeeded and the SVG has been drawn. Then ask wkhtmltopdf to wait for that exact value before rendering.
1. Set the readiness marker after rendering
Put the marker at the end of the successful rendering path, not immediately after starting the request. In a real application, substitute its AJAX and SVG-rendering code for the illustrative comments:
<script>
fetch('/chart-data')
.then(response => {
if (!response.ok) throw new Error(`HTTP ${response.status}`);
return response.json();
})
.then(data => {
// Apply data and create/update the SVG here.
renderChartAsSvg(data);
// Set this only after the SVG has been created.
window.status = 'pdf-ready';
})
.catch(error => {
console.error('Chart could not be prepared for PDF:', error);
// Do not set pdf-ready on failure; diagnose the failed request instead.
});
</script>
renderChartAsSvg is an application-specific placeholder, not a built-in browser function. If your chart library schedules additional drawing work after the function returns, move the marker to the library’s completion callback or other point at which the SVG is truly ready. If fonts, images, or other resources must also load before capture, include their completion in the readiness condition.
2. Match the marker in the command
wkhtmltopdf --window-status pdf-ready input.html output.pdf
For a remote page, use its URL in place of input.html. The manual defines --window-status <value> as waiting until window.status equals the specified string before rendering. The value must match exactly. A marker that is never set can leave the command waiting; use this method only when the page can reliably reach the marker.
When the request can fail, consider making that failure visible in page logs or in application-specific status handling. A readiness marker should mean “the content intended for the PDF is ready,” not simply “the request was attempted.”
Rank #2
Fallback: wait a fixed amount of time
If you cannot edit the page to add a completion marker, use --javascript-delay to give its scripts and request more time:
wkhtmltopdf --javascript-delay 3000 https://example.com/report input.pdf
Replace the example URL with the page you need to convert. The value is milliseconds; 3000 requests a three-second delay. The wkhtmltopdf manual documents a default delay of 200 milliseconds, which may be too short for an asynchronous request and chart render. Choose a delay based on the page’s observed behavior, then inspect the resulting PDF.
A fixed delay is a guess, not a signal that a specific request or SVG operation finished. A slow response can outlast it; a long delay also makes every conversion wait even when the page becomes ready sooner. Where available, a library wrapper exposes the corresponding load.jsdelay setting; its settings reference says the wait is after page load and can finish early if JavaScript calls window.print().
Recommended Free Tools
Check resources and JavaScript before tuning waits
A longer wait will not fix a script error, a blocked request, or an inaccessible local file. Before increasing the delay repeatedly, confirm that the input page can obtain the data and resources it needs in the wkhtmltopdf execution environment.
- Confirm JavaScript is enabled. It is enabled by default according to the manual, but an invocation or wrapper may override that behavior. Check for settings that disable JavaScript.
- Inspect JavaScript diagnostics. Add
--debug-javascriptto expose JavaScript warnings and errors while diagnosing the page. - Check the request and its data. Confirm the AJAX endpoint is reachable from the process running wkhtmltopdf and that it returns the expected response. Authentication, network access, or an application error can prevent the chart from being built.
- Check SVG dependencies. Verify that external images, stylesheets, fonts, scripts, and other resources referenced by the SVG or HTML can load. The manual documents image-loading controls and load-error settings that can assist diagnosis.
- Review local-file access. For local HTML or assets, check the manual’s local-file-access controls and whether the process is allowed to read the required paths. Do not enable broader access than the job needs.
- Compare against the intended page. Inspect the PDF itself: look for an absent chart, a partially drawn SVG, missing labels, or a layout difference. A successful process exit alone does not establish that the page rendered as intended.
Choose the wait strategy
| Approach | What controls rendering | Best fit | Main limitation |
|---|---|---|---|
--window-status |
A string set by the page when its readiness condition is met | You can modify the page and identify when its data and SVG are ready | The page must reach the marker; script failures or stalled work can prevent it |
--javascript-delay |
A fixed elapsed time in milliseconds | You cannot instrument the page and can determine a suitable wait empirically | It can be too short for slow work or unnecessarily long for fast work |
Use the readiness marker when possible because it ties rendering to application state. Use a delay when page changes are out of reach, and treat its duration as a setting to validate rather than a guarantee.
Rank #3
- hole punched
- high quality card stock
- 4 pages
- made in USA
- keyboard shortcuts
When the output is still blank or incomplete
The command finishes before the chart appears
First confirm whether the page uses the default or an explicitly configured delay, and whether the AJAX request succeeds in the converter’s environment. If the page is under your control, instrument a readiness marker after chart creation. If it is not, increase the delay cautiously and check several runs that reflect normal and slower response times.
The readiness marker is never reached
Check the JavaScript console output exposed by --debug-javascript, then verify the request’s response and the chart-rendering path. A marker set only on success will correctly remain unset when an earlier step fails. Diagnose that failure instead of moving the marker earlier, which can produce a PDF with missing content.
Free tools Windows power users keep installed
One-click scans. No signup required.
The SVG appears but is missing styling, images, or labels
Inspect the page’s external dependencies and local-file permissions. Confirm that URLs referenced by the HTML and SVG resolve from the machine running wkhtmltopdf, not merely from your desktop browser. Review relevant image-loading and load-error settings in the manual.
A modern chart library behaves differently than in a browser
wkhtmltopdf uses Qt WebKit, and the sources reviewed here do not establish equivalence with a current desktop browser or provide a current compatibility matrix. A historical 2015 project issue described a Plotly page that did not behave as expected despite attempts involving --javascript-delay and --window-status. That report is a warning to test a specific page and build, not evidence that all Plotly charts or SVGs fail.
For a reproducible failure, reduce the page to the smallest case that still has the problem. Record the exact wkhtmltopdf build, operating system, input URL or file, command options, and whether the data and SVG are created in an ordinary browser. This helps separate timing and resource problems from build-specific JavaScript incompatibility.
Rank #4
Or skip the browser setup
If your goal is a clean visual capture rather than a PDF produced by your own wkhtmltopdf installation, ScreenshotNeo is a website screenshot API and MCP server. A GET request can return a screenshot or PDF; the example below requests a screenshot in WebP format. For PDF capture and other options, see the ScreenshotNeo documentation.
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/consent banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, and failed loads are not billed. Its MCP server gives AI agents tools for screenshots and PDF capture. The Free plan includes 1,000 screenshots per month with no card, and paid plans start at $5 for 3,000. Each feature is available on every plan.
Sign up for 1,000 free screenshots a month, with no card required.
Frequently Asked Questions
Does wkhtmltopdf support SVG generated after an AJAX request?
The documented controls let you wait for page JavaScript, but the documentation does not establish a complete compatibility guarantee for arbitrary AJAX applications or SVG features. Test the target page with the installed build.
Can I use window.status with a remote URL?
Yes, when the remote page’s scripts can set the chosen status string in the wkhtmltopdf page context. Use the exact same value in the page and the command.
Will –javascript-delay fix every missing chart?
No. It only waits for a duration. It cannot correct a failed request, JavaScript error, inaccessible resource, or incompatible page behavior.
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.




