Free tools Windows power users keep installed
One-click scans. No signup required.
Short answer: choose a PDF renderer that actually runs browser JavaScript before layout. Dompdf does not execute ordinary page JavaScript; its isJavascriptEnabled setting concerns scripts embedded in the finished PDF for the PDF viewer. If your HTML is populated by an external script, use a renderer with page-execution support, such as wkhtmltopdf, and configure resource access plus a wait period that matches the page. The correct fix depends on the renderer, wrapper, binary version and whether the page is public or authenticated.
First identify what “JavaScript enabled” means
There are two unrelated operations that are often described with the same words:
- Browser-side execution before capture: the renderer loads HTML, downloads an external script, runs it, waits for the application to become ready and then lays out the resulting DOM.
- PDF-viewer scripting: JavaScript is embedded in the PDF and may run later when a reader opens the file.
Dompdf documents the second behavior, not the first. Its own options source explicitly distinguishes PDF-based JavaScript from browser-based JavaScript executed by Dompdf (Dompdf Options.php). Turning on that option will not make a React, Vue, Angular or vanilla script populate the page before Dompdf calculates the PDF layout.
For a page that must execute JavaScript during capture, select an engine that documents page execution. wkhtmltopdf documents JavaScript execution, a configurable delay and the ability to run an additional script after page load (wkhtmltopdf usage documentation). Verify the actual wkhtmltopdf binary and PHP wrapper installed on your server; the documentation reviewed here does not establish maintenance status or compatibility for every current deployment.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
#1 Best Overall
How to diagnose a blank or incomplete PDF
- Record the stack. Write down your PHP version, package name, wrapper, renderer binary and their versions. “A PHP PDF library” is not specific enough to predict JavaScript behavior.
- Define the expected change. If a script inserts visible text, fetches API data or renders a chart before printing, you need browser execution. If you only want a script to run when someone opens the PDF, that is a different requirement.
- Check the script URL from the renderer’s network. A URL that works in your desktop browser can fail on the server because of DNS, firewall rules, TLS certificates, authentication, cookies, a restrictive user agent or a blocked origin.
- Confirm readiness. “The HTML response arrived” does not mean asynchronous JavaScript finished. Use a delay or another readiness mechanism supported by your renderer and test with the slowest realistic API response.
- Reduce the case. Create a page containing one external script that changes one visible element. Render it and inspect the PDF. This isolates JavaScript execution from CSS, fonts, images and application code.
Dompdf: what it can and cannot do
Dompdf is a PHP, style-driven HTML/CSS renderer. It can process HTML and external stylesheets, but its documented JavaScript option is for code that a PDF viewer may execute after the file is opened. It is therefore not a solution for server-side execution of an external page script.
If your input is already fully rendered HTML, Dompdf may still be appropriate. Render the application first (for example, in a real browser or a JavaScript-capable service), then pass the resulting HTML to Dompdf. Do not expect this configuration to run the application’s scripts:
<?php
require __DIR__ . '/vendor/autoload.php';
use DompdfDompdf;
use DompdfOptions;
$options = new Options();
// This does not execute browser JavaScript that builds the page.
$options->setIsJavascriptEnabled(false);
$dompdf = new Dompdf($options);
$html = file_get_contents(__DIR__ . '/already-rendered.html');
$dompdf->loadHtml($html);
$dompdf->setPaper('A4');
$dompdf->render();
$dompdf->stream('document.pdf', ['Attachment' => false]);
Remote-resource settings and defaults can vary by release. The current options source describes remote access as security-sensitive and disabled by default in that source. Consult the version you deploy and allow only resources you have validated. Dompdf’s security guidance recommends validating resource references and avoiding embedded scripts for untrusted documents (Dompdf security guidance).
wkhtmltopdf: execute the page, then print it
wkhtmltopdf is a possible path when the page itself must run JavaScript. Its command-line documentation says JavaScript is enabled by default and documents a --javascript-delay option whose documented default is 200 milliseconds. That default is not a guarantee that an application is ready; a page waiting on an API, font or chart may need longer.
Minimal command-line test
Start with a public test page and an explicit delay:
Rank #2
wkhtmltopdf --javascript-delay 1500 https://example.com rendered.pdf
Use the delay only as long as necessary. A fixed wait that is too short captures placeholders; one that is unnecessarily long reduces throughput. The usage documentation also describes running an additional script after page load, which can be useful when a page exposes a deterministic “ready” action. Follow the syntax documented by the exact binary installed on your server.
Calling the binary from PHP
The PHP wkhtmltox binding exposes loading controls for JavaScript, local-file behavior and related resource settings. Wrapper names differ, so map the concepts to your package’s API and inspect warnings from the renderer:
<?php
$input = 'https://app.example.test/report?id=42';
$output = __DIR__ . '/report.pdf';
$command = sprintf(
'wkhtmltopdf --javascript-delay %d %s %s 2>&1',
2000,
escapeshellarg($input),
escapeshellarg($output)
);
exec($command, $log, $status);
if ($status !== 0 || !is_file($output) || filesize($output) === 0) {
throw new RuntimeException("wkhtmltopdf failed:n" . implode("n", $log));
}
For production, prefer your wrapper’s structured API where available, capture stderr, set an execution timeout and avoid concatenating user-controlled arguments. If the page requires login, provide the renderer with the cookies, headers or authentication mechanism supported by your wrapper. A browser on your laptop being logged in does not transfer that session to a server process.
External scripts and local files
Check all of the following from the rendering host:
- The external JavaScript URL resolves and is reachable over the server’s network.
- TLS certificates, proxies and outbound firewall rules permit the request.
- Required cookies, authorization headers and user-agent behavior are present.
- Relative URLs resolve against the intended base URL.
- Fonts, images, CSS and API requests are available, not just the first HTML document.
- Local-file access is enabled only when required and only for approved paths.
The PHP binding constructor documentation describes loading options, including JavaScript and local-file access behavior (PHP wkhtmltox binding manual). Option names in a PHP wrapper may not match command-line names exactly.
Make readiness deterministic
A delay is a fallback, not an application contract. If you control the page, expose a predictable readiness signal: render the final content, finish required API calls, then set a marker such as window.reportReady = true or replace a known loading element. Use the renderer’s documented post-load script or waiting facility to act on that signal where supported. If you cannot add a signal, measure the slowest normal response and choose a bounded delay, then verify output rather than assuming success.
Do not solve a browser-JavaScript problem by enabling server-side PHP execution inside untrusted HTML. That changes the trust boundary and can expose the host to code execution.
Renderer comparison for JavaScript-populated pages
| Renderer | What the reviewed documentation establishes | When it fits |
|---|---|---|
| Dompdf | PHP HTML/CSS rendering; its JavaScript option embeds PDF-viewer scripting, not browser execution during rendering. | Use for already-rendered HTML when browser execution is unnecessary. |
| wkhtmltopdf | Documents page JavaScript, a JavaScript delay, post-load script execution and loading controls. | A possible route when the page must execute JavaScript before capture; verify your binary and wrapper. |
| mPDF | Documents a PHP HTML/CSS workflow and warns against unvetted outside-user HTML/CSS; the reviewed material does not establish browser JavaScript execution. | Do not select it as a proven JavaScript-execution fix based on the reviewed documentation. |
Compare engines on execution support, readiness detection, network and local-resource permissions, PHP and binary compatibility, and controls for untrusted HTML. No single option name answers all five questions.
Troubleshooting checklist
The PDF shows the loading shell
The script probably did not run, or the capture occurred too early. Confirm you are not using Dompdf for browser execution, verify the script request from the server, then increase or replace the wait with a readiness signal.
The script works in a browser but not on the server
Compare DNS, outbound access, TLS, cookies, authorization headers, user agent and API origin rules. Log renderer warnings and test the script URL directly from the rendering host.
Rank #4
Images or fonts are missing
These are separate resource requests. Check URL resolution, permissions and network access for every asset. A successful HTML request does not prove that subordinate resources loaded.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Fix the driver behind crashes, sound loss and screen glitches3Repair Windows errors before they cause bigger problemsLocal development works but production fails
Compare installed binary and wrapper versions, filesystem permissions, sandboxing, proxy configuration and allowed local-file paths. Reproduce with the minimal one-script page before changing application code.
Untrusted HTML is involved
Allow-list resource hosts, avoid broad local-file access, sanitize HTML and do not enable embedded PHP or other execution features for untrusted input. Dompdf’s security guide explains why remote resources and embedded scripts require particular care.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Or skip the browser setup
If your goal is a PDF or image of a publicly reachable page rather than managing a PHP renderer, ScreenshotNeo provides a website screenshot API and MCP server. One GET request can return PNG, JPEG, WebP or a PDF, and an AI agent can use its capture_pdf tool through MCP.
Example request (see the ScreenshotNeo API documentation):
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp
ScreenshotNeo accepts cookie and consent banners before capture and removes more than 60 known consent platforms, newsletter popups and chat widgets; each step can be disabled. Bot checks, blank pages, timeouts, failed loads and cache hits are not billed, and response headers identify the page verdict and whether it was billed. It also supports full-page capture with lazy images loaded, CSS selectors, custom JavaScript, waits, headers, cookies, authorization, device and viewport settings, PDF controls, caching, signed links, asynchronous jobs and bulk capture.
The Free plan includes 1,000 screenshots per month with no card. Paid plans start at $5 for 3,000 shots; every feature is on every plan. Create a free ScreenshotNeo account to try it without a card.
Operational and cost considerations
- Performance: JavaScript execution, network requests and long waits increase per-document latency. Keep delays bounded and remove unnecessary third-party assets.
- Reliability: Treat renderer warnings, non-zero exits, empty files and missing readiness markers as failures. Store logs with the document job so intermittent network errors can be diagnosed.
- Security: Rendering remote or user-controlled HTML is an outbound-request and local-file boundary. Validate URLs and headers, restrict hosts and isolate the renderer where practical.
- Versioning: Pin and record the PHP package, wrapper and binary. The wkhtmltopdf usage page reviewed here is on its mutable
masterbranch, so verify behavior against what you actually deploy.
FAQ
Can I fix Dompdf by setting isJavascriptEnabled to true?
No. That setting is documented for JavaScript executed by the PDF viewer, not for constructing the page in a browser-like rendering pass.
Is the documented 200 ms delay enough?
It is wkhtmltopdf’s documented default, not a universal readiness threshold. API calls and asynchronous applications often require a different strategy.
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 →Should I use mPDF for a JavaScript application?
The reviewed mPDF material does not establish browser JavaScript execution, so it is not evidence for that use case.
Why does a public page render but my dashboard does not?
Dashboards commonly require authentication, cookies, authorization headers and API calls. The rendering process must receive those credentials and be allowed to reach every dependent resource.
Frequently Asked Questions
Can a PDF contain JavaScript even when the page script never ran?
Yes. PDF-viewer scripting and browser-side page execution are separate features; a renderer can embed viewer scripts without running the application that builds the HTML.
What is the safest first diagnostic?
Render a minimal page with one external script that changes one visible value, then inspect renderer logs and the resulting PDF before debugging the full application.
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 matchQuick 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.

