wkhtmltopdf exit code 1 is a failure signal, not a diagnosis. Read the complete standard error output and identify the exact page, URL, or local file that failed to load before changing options. A PDF file may still exist after a nonzero exit, but its presence does not prove that the document is complete or that all assets loaded.
What exit code 1 means
The text following due to network error is usually the useful clue. Reported messages include HostNotFoundError, ProtocolUnknownError, and ContentOperationNotPermittedError. They point to different resource-loading problems; they are examples, not a complete error taxonomy. The exact cause of your run cannot be established without its command, stderr, input, binary build, operating system, and network or file-access context.
Start by preserving the full error output and locating each Error: Failed to load line. Determine whether the named resource is the main page or a dependent stylesheet, script, image, iframe, header, or footer asset.
Diagnose and fix the failed resource
Host lookup, connectivity, or remote assets
If stderr names a host or remote URL, test that exact address from the same machine or container and runtime identity that runs wkhtmltopdf. Check DNS resolution, outbound connectivity, proxy settings, redirects, and whether the asset host is reachable from that environment. An archived report describes HostNotFoundError while converting a document with remote assets and an iframe; it does not identify which resource caused that particular failure (reported issue).
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →#1 Best Overall
- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
Local files and relative paths
For local HTML, verify that every linked file resolves from the input document’s actual location, or configure an intentional base URL. Check file permissions and wkhtmltopdf’s local-file-access policy. The command-line documentation describes --disable-local-file-access, --enable-local-file-access, and --allow for specifying permitted files (official usage documentation).
Use the narrowest local access that works. Enabling broad access can expose files on the machine to HTML being converted; do not allow untrusted documents to read local paths.
Rank #2
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
HTTP errors, SSL, authentication, and redirects
When the log names an HTTPS resource, inspect the complete URL and the response actually received, including redirects and authentication requirements. One archived report records an HTTP 403 and ContentOperationNotPermittedError in an SSL deployment (reported issue). Check whether the resource is authorized and available to the conversion process. Switching to HTTP is not a generally valid or safe fix.
Protocol errors and wrapper behavior
If stderr says ProtocolUnknownError or mentions about:blank, inspect generated HTML, CSS, and JavaScript for empty, malformed, or unsupported resource URLs. A 2022 report involved a Python pdfkit.from_string(html, False) call that failed while writing to a file path worked in that reporter’s setup (reported issue). Treat this as a wrapper-specific clue: compare the wrapper’s actual input and invocation with a direct wkhtmltopdf run instead of assuming that output mode is universally faulty.
Rank #3
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
Error-handling options
The CLI documents --load-error-handling <handler> for pages that fail to load; its listed handlers are abort, ignore, and skip, with abort as the default. It also documents --load-media-error-handling <handler> for media failures, with ignore as the default (official usage documentation).
Use a handler that ignores or skips a failure only when the missing content may safely be omitted. These options do not guarantee that every underlying network error will be suppressed or that the process will exit successfully. After changing a handler, check the exit status, stderr, and the PDF’s content; issue reports show that a PDF can appear to have been produced even when the command returns code 1 (reported issue, reported issue).
Rank #4
- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
A reliable troubleshooting sequence
- Capture the whole failure. Save stderr, the exact command, and the resulting exit status. Do not rely on the final line alone.
- Record the environment. Run
wkhtmltopdf --version; note the package or build source, operating system and version, and whether a wrapper launches the executable. - Identify each failed dependency. For every
Error: Failed to loadline, test the named URL or file from the same runtime environment and classify the resource (page, stylesheet, script, image, iframe, header, or footer). - Fix the underlying cause. Correct an unavailable host, inaccessible URL, bad response or authorization, malformed or empty resource URL, incorrect relative path, or restrictive local-file policy. Do not suppress a failure until you have decided that the missing content is acceptable.
- Test one change at a time. If you try a load-error handler, rerun the same input, then inspect stderr, exit status, and the PDF for missing content.
- Reduce the reproduction. Make a small HTML file with only the assets needed to trigger the problem. The project’s support guidance asks for the version, operating system and version, a detailed description, and a reproducer (official support page).
Version and security considerations
The official downloads page identifies wkhtmltopdf 0.12.6 as the stable series and gives June 11, 2020 as its release date (downloads page). That page’s statement does not establish that every operating-system package is equivalent or that no later fork or build exists. Confirm the installed binary’s version and provenance before applying version-specific advice.
The project warns: “Do not use wkhtmltopdf with any untrusted HTML – be sure to sanitize any user-supplied HTML/JS, otherwise it can lead to complete takeover of the server it is running on!” (project security warning). Treat HTML and JavaScript as security-sensitive input, particularly when changing local-file access.
Recommended Free Tools
Best Value
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
Or skip the browser setup
If your goal is to capture a web page rather than troubleshoot a wkhtmltopdf conversion, ScreenshotNeo can return a screenshot or PDF from one GET request. This is an alternative capture workflow, not a fix for a broken wkhtmltopdf installation. The example requests a PDF:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -d format=pdf -o page.pdf
See the ScreenshotNeo API documentation for request options. Cookie banners, popups, and chat widgets are removed before capture; bot checks, blank pages, and failed loads are never billed. An MCP server lets AI agents take screenshots. The free plan includes 1,000 screenshots a month with no card, and paid plans start at $5 for 3,000. Sign up for free.
Frequently Asked Questions
Can I trust the PDF if wkhtmltopdf returned code 1?
No. A file may have been written even though a resource failed or the process returned a nonzero status. Verify the output’s pages and required assets against the source.
Which details should I include when asking for help?
Provide the exact command, full stderr, binary version and build source, operating system and version, whether a wrapper is involved, and a minimal reproducible input.
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.

