Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problemsExit status 1 is a wrapper error, not a diagnosis. wkhtmltopdf failed while finding its executable, rendering HTML, loading a stylesheet/image/font/script, resolving a URL, or writing the PDF. Read the complete stderr suffix, verify the exact binary used by Django, save the generated HTML, and run the identical command outside the web worker. The suffix—such as ContentNotFoundError, HostNotFoundError, or ProtocolUnknownError—usually identifies the repair.
What “non-zero exit status 1” actually means
django-wkhtmltopdf launches the wkhtmltopdf process and reports a Python exception when that process returns a non-zero code. Code 1 only says that conversion did not complete cleanly. It does not tell you whether the problem is a missing binary, broken template, unreachable asset, DNS, protocol policy, permissions, or an incompatible build.
A PDF may even be left on disk while the process exits 1 because a non-critical resource failed. Treat that output as suspect until stderr is clean and the process returns zero.
The practical debugging order is:
- Expose the complete stderr output.
- Confirm the executable, version, architecture, and service account.
- Render and inspect the HTML separately.
- Test every asset from the converter’s network and filesystem context.
- Reproduce the exact command outside Django, then restore the Django configuration.
1. Capture stderr before changing options
Quiet mode often hides the only useful clue. Temporarily remove quiet from WKHTMLTOPDF_CMD_OPTIONS, enable application logging, or run wkhtmltopdf manually with stderr visible. Record the complete command line, not just the final Python exception.
#1 Best Overall
- 12th Intel Alder Lake N95 Processor – The GMKtec G3 S Mini PC is powered by the 12th Gen Intel N95 processor with 4 cores, 4 threads, 6MB cache and a burst frequency up to 3.4GHz. Compared with N100/N5105/N5100/N5095, the N95 delivers up to 36% overall performance improvement. Perfect for routine tasks, office work, and home entertainment, this compact mini desktop is more convenient than traditional bulky PCs.
- 8GB RAM & 256GB SSD Storage – Pre-installed with 8GB DDR4 memory and a fast 256GB M.2 2242 SSD, the G3 S mini desktop offers quicker startup, smoother multitasking, and faster file transfers. Enjoy seamless performance whether you’re working on multiple applications, browsing, or streaming content.
- Rich Interfaces & Connectivity – The G3 S mini computer comes equipped with USB 3.2 (up to 10Gbps), dual HDMI 2.0 (4K@60Hz), and a 3.5mm audio jack. With support for WiFi 5, Bluetooth 5.0, and Gigabit Ethernet (RJ45 1000MbE), it connects easily with monitors, projectors, printers, office equipment, and other peripherals, making it versatile for both home and business use.
- Dual 4K Display Support – Featuring upgraded Intel UHD Graphics (up to 1000MHz), the G3 S supports 4K video playback and AV1 decoding for a smooth viewing experience. With dual HDMI outputs, you can connect two 4K@60Hz displays simultaneously, enabling efficient multitasking for work and entertainment.
- GMKtec WARRANTY - GMKtec offers a 1-year limited GMKtec's warranty for each mini PC, starting from the date of the purchase. All defects due to design and workmanship are covered. With a professional after sales team always ready to attend to your needs, you can simply relax and enjoy your mini PC.
wkhtmltopdf --version
wkhtmltopdf --encoding utf-8 https://example.com/report report.pdf
If your input is a saved file, use the same form Django uses:
wkhtmltopdf --encoding utf-8 /tmp/report.html /tmp/report.pdf
Keep the stderr suffix exactly as printed. ContentNotFoundError, HostNotFoundError, and ProtocolUnknownError lead to different fixes.
2. Verify the binary Django is really running
A shell and a Gunicorn, uWSGI, Celery, or systemd worker can have different PATH, permissions, libraries, and environment variables. Check resolution as the same operating-system user and inside the same container or virtual machine:
command -v wkhtmltopdf
wkhtmltopdf --version
id
Set an absolute path when there is any doubt. django-wkhtmltopdf uses WKHTMLTOPDF_CMD; pdfkit has an equivalent explicit configuration override.
# settings.py
WKHTMLTOPDF_CMD = "/opt/wkhtmltox/bin/wkhtmltopdf"
WKHTMLTOPDF_CMD_OPTIONS = {
"encoding": "utf-8",
# Leave out "quiet" while diagnosing failures.
}
Confirm that the worker can execute the file and load its shared libraries. “No wkhtmltopdf executable found” or a failure before any page output normally means the path, execute permission, dependency, or architecture is wrong—not an HTML problem.
Rank #2
- 【Powerful AMD Core Running Performance】Adopt AMD Ryzen 5 7430U processor with 6 cores 12 threads, clock speed reach up to 4.3GHz. This mini computer delivers steady running performance to match daily office operation, daily home entertainment and light gaming usage demands, stable output without frequent stutter, fit for long time daily use.
- 【Smooth 4K Multi-screen Display Output】Built-in AMD Radeon graphics card with 1800MHz working frequency, this mini gaming pc supports 4K 60Hz video output. Equipped with HDMI, DP 1.2 and Type-C three display interfaces, users can freely combine connection ways to realize triple screen linkage, convenient for multi-task work split screen operation and high-definition video playback, improve daily operation efficiency effectively.
- 【Rich Interfaces & Stable Dual LAN Transmission】This mini pc comes with complete daily mainstream ports, including multiple USB 3.2/USB2.0 ports, audio jack, DC power port and other common interfaces. Equipped with 2.5G dual RJ45 wired network port, support fast and stable data transmission, can stably connect with monitor, projector, office equipment and household audio-visual devices, meet diversified external connection needs.
- 【Dual High-speed Wireless Connection Mode】Equipped with WiFi6 wireless network module and upgraded Bluetooth 5.3 version on this micro pc. WiFi6 brings faster network access speed and smoother network signal transmission; Bluetooth 5.3 realizes low-delay stable connection with wireless keyboard, mouse, headset, printer and other peripheral devices, optimize daily wireless using experience.
- 【Large Expandable Memory & Reliable Heat Dissipation】Configured with 16GB 3200MHz DDR4 RAM and 512GB built-in SSD, users can expand memory up to 64GB and solid state storage up to 4TB through reserved expansion slots. Compact body structure adopts aluminum alloy shell and honeycomb heat dissipation holes, speed up internal air circulation, lower operating temperature, maintain long-term stable operation and extend service life.
3. Inspect the HTML independently of PDF conversion
When the package supports it, request the Django view as HTML with ?as=html during development. Save that response and inspect what the converter receives. Look for relative URLs, redirects, authentication requirements, empty template variables, and references to files that exist only on a developer workstation.
curl -L "https://app.example.com/invoice/42?as=html" -o /tmp/invoice.html
wkhtmltopdf --encoding utf-8 /tmp/invoice.html /tmp/invoice.pdf
Opening the page in a normal browser is not equivalent. The browser may have your login cookies, DNS configuration, proxy, cached assets, JavaScript capabilities, and a different current URL. A local HTML file also has a different base URL from a web page, so relative references can stop resolving.
4. Make every resource reachable
Stylesheets, images, web fonts, and scripts must be reachable from the converter host and service account. Prefer absolute http:// or https:// URLs, or valid file paths when local files are deliberately enabled.
Recommended Free Tools
- Replace
css/invoice.csswith a fully qualified URL or a verified absolute path. - Check that the URL returns the expected status and content from the converter host, not only from your laptop.
- Ensure Django’s static/media server is exposed to the container or private network where wkhtmltopdf runs.
- Verify redirects, TLS certificates, authentication headers, and cookies.
- Check that filenames and URL encoding match the case-sensitive filesystem.
Test each suspect URL as the worker user. A 404, inaccessible local file, or blocked private hostname commonly produces ContentNotFoundError.
5. Use the stderr suffix to choose the fix
| Observed message or symptom | Likely cause | Fix |
|---|---|---|
ContentNotFoundError |
Missing CSS, image, font, or script; bad relative path; HTTP 404; inaccessible local file. | Use absolute URLs or valid paths, then verify files and HTTP responses in the worker’s environment. |
HostNotFoundError |
DNS failure, wrong hostname, isolated container, or unreachable localhost. |
Use a resolvable service hostname, expose the server to the converter, and test from the same network namespace. |
ProtocolUnknownError |
about:blank, malformed URL, unresolved relative reference, or blocked local-file access. |
Remove invalid protocols, supply a correct base URL, and review local-file-access settings. |
| “Blocked access to file” | The build is refusing a local resource under its file-access policy. | Prefer HTTP(S) assets; if local access is required, enable only the narrowly needed directories and keep the input trusted. |
| A PDF appears but the process exits 1 | A non-critical resource still failed. --load-error-handling ignore does not suppress every failure. |
Find and fix the failing reference; do not treat the produced PDF as proof of a successful run. |
| Works locally, fails after deployment | Different package build, missing libraries/fonts, architecture or libc mismatch, or AppArmor/SELinux/container policy. | Compare the complete runtime and dependencies, then test the deployed binary as the service user. |
| Unicode or non-Latin text is broken | Missing UTF-8 declaration or unavailable fonts. | Add the charset declaration and install/check fonts visible to fontconfig. |
6. Fix protocol, local-file, and authentication problems safely
HTML generated from a file needs a meaningful base URL. A relative stylesheet in /tmp/report.html is resolved relative to that directory, not your Django site. Rewriting asset links to absolute URLs is usually safer than granting broad local-file access.
Rank #3
- 【AMD Ryzen 3 5300U CPU: Outperforms N150 & 3500U】 BOSGAME E5 mini PC is powered by the TSMC 7nm FinFET architecture AMD Ryzen 3 5300U processor (4 Cores, 8 Threads, up to 3.8GHz boost, 6MB total cache). Compared to low-end Intel N150 or 3500U chips which only have 4 single threads and throttle under load, the 5300U delivers over 30% faster multi-core speed. Run 30+ browser tabs, large Excel sheets, and Zoom meetings simultaneously without system lag.
- 【8GB DDR4 RAM & 256GB NVMe SSD Storage】 Installed with high-speed 8GB DDR4 dual-channel memory and a fast 256GB M.2 2280 SSD, eliminating slow boot times and application loading delays. To accommodate growing data requirements, the upgradeable hardware design features dual SODIMM slots that allow you to expand memory up to 64GB RAM, ensuring smooth operation during heavy multitasking.
- 【High-Capacity Dual M.2 SSD Storage Expansion】 Never worry about running out of space for your business files. In addition to the pre-installed 256GB system drive, the motherboard houses an extra empty internal M.2 2280 NVMe PCIe 3.0 slot. This allows you to easily add a second solid-state drive for up to an additional 2TB of storage capacity (upgrades not included) without needing to remove or reinstall the original operating system.
- 【Radeon 6-Core Graphics & Triple 4K Displays】 Integrated with official AMD Radeon Graphics (6 Graphics Cores, 1500 MHz frequency) for casual gaming, photo editing, and crisp 4K media decoding. Featuring 1x HDMI 2.0 port, 1x DisplayPort, and 1x Full-Function Type-C port, the E5 outputs true 4K@60Hz resolution to three monitors at once. This multi-screen setup eliminates constant window-switching for traders, programmers, and office workers.
- 【Dual 2.5GbE LAN Ports for Advanced Networking】 Experience fast wired network transmission speeds up to 2500Mbps without lagging or buffering. The integration of dual 2.5 Gigabit Ethernet ports (powered by Realtek RTL8125 controller) makes this compact computer an exceptional hardware choice for tech enthusiasts. Easily configure it into software routers, hardware firewalls (pfSense, OpnSense), home NAS servers, or local homelabs.
If private endpoints require authentication, provide the required cookies or headers through the supported command options, or expose a short-lived, access-controlled rendering URL. Do not embed long-lived secrets in user-visible HTML.
wkhtmltopdf’s project warns not to render untrusted HTML or JavaScript because it can lead to complete server takeover. Sanitize user-supplied markup and restrict local-file access to the smallest necessary directory. Never pass arbitrary user HTML directly to a privileged converter.
7. Check the wkhtmltopdf build and operating system
The project identifies 0.12.6 as its stable series, released June 11, 2020, and its repository is archived. Distribution packages can have reduced functionality compared with a supported upstream/static build. Compare:
- wkhtmltopdf version and build metadata
- CPU architecture and libc version
- Qt and OpenSSL libraries
- fontconfig and installed fonts
- container base image and mandatory-access-control policy
Use a build supported for your operating system and test it in the same image used in production. Installing a different binary without checking its dependencies can replace an obvious error with missing-library or font failures.
8. Configure django-wkhtmltopdf explicitly
Once the command works manually, put the same options in the view or global settings. Keep diagnostic logging enabled until the deployment is stable.
Rank #4
- 【Powerful & Efficient Performance】Powered by the Intel Celeron J3355 Processor (up to 2.5GHz), this Mini PC delivers a 25% performance boost over previous generations. Pre-installed with Windows 11 Home and supporting Linux/Ubuntu, it’s the ideal micro desktop for seamless web browsing, document editing, and efficient daily office tasks.
- 【Massive Storage & Unique Expansion】Equipped with 6GB LPDDR3 RAM and 128GB onboard storage for fast boot-ups. Stand out with our dual M.2 SSD slot design (1x SATA + 1x NVMe), allowing you to easily expand storage up to 2TB without replacing the original drive. Perfect for managing large digital libraries and intensive multitasking.
- 【Stunning 4K Dual HDMI Display】Boost your productivity with Intel HD Graphics 500 and dual HDMI ports, supporting 4K @60Hz high-definition visuals. Connect two monitors simultaneously to streamline your workflow—ideal for home office setups, stock trading, or enjoying a theater-like 4K media experience.
- 【Ultra-Compact & Space-Saving Design】Measuring only 4.2x4.1x1.4 inches and weighing just 0.49 lbs, this palm-sized mini computer fits anywhere. Use the included VESA bracket to mount it behind your monitor for a zero-clutter workspace. Features a smart silent fan and heat sink system for quiet, reliable 24/7 operation.
- 【Stable Connectivity & Smart Recovery】Stay connected with Dual-Band WiFi (2.4G/5G), Bluetooth 5.0, and Gigabit Ethernet. Exclusive One-Click Restore feature (via F9 key) allows for quick system recovery in minutes. Backed by Bmax's 12-month warranty and lifetime technical support for a worry-free purchase.
# settings.py
WKHTMLTOPDF_CMD = "/opt/wkhtmltox/bin/wkhtmltopdf"
WKHTMLTOPDF_CMD_OPTIONS = {
"encoding": "utf-8",
}
from wkhtmltopdf.views import PDFTemplateView
class InvoicePDF(PDFTemplateView):
template_name = "billing/invoice.html"
filename = "invoice.pdf"
cmd_options = {
"encoding": "utf-8",
"print-media-type": True,
}
Add options one at a time. If a new option causes failure, remove it and reproduce the resulting command manually. Avoid hiding errors with blanket ignore settings; they can produce incomplete documents.
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 matchWindows 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 reinstall9. Encoding, fonts, and static assets
Put an explicit declaration in the document head:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Install the fonts required by your invoice or report in the converter image and verify that fontconfig can see them under the service account. A browser’s locally installed font is not available inside a minimal server container. For deterministic output, package the font files and CSS with the deployment, while respecting their licenses.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.10. Deployment and reliability checklist
- Run the exact command in the production container, not only on a workstation.
- Use the service hostname instead of
localhostwhen the converter is in another container. - Check outbound firewall rules, DNS, proxy variables, and TLS trust stores.
- Confirm write permission for the temporary directory and final output path.
- Set a process timeout appropriate to page complexity, but investigate timeouts rather than retrying forever.
- Log stderr, exit code, binary version, input URL or template identifier, and output path.
- For large jobs, queue conversion in Celery or another worker so web requests are not held open.
Repeated retries do not fix deterministic 404s, invalid protocols, or missing fonts. They can multiply load on a failing service. Fix the layer identified by stderr first.
Or skip the browser setup
If your goal is a hosted screenshot or PDF of a reachable Django page rather than maintaining wkhtmltopdf on your server, ScreenshotNeo provides a single HTTP request. It accepts consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and each response identifies the result with X-Page-Verdict and X-Billed headers. Its MCP server gives Claude, Cursor, and other MCP clients take_screenshot, get_page_info, and capture_pdf tools.
For API details, see the ScreenshotNeo documentation. Replace the URL with your publicly reachable Django endpoint:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://your.example.com/invoice/42 -o shot.webp
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://your.example.com/invoice/42"}, timeout=90)
r.raise_for_status()
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://your.example.com/invoice/42' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`Screenshot failed: ${res.status}`);
ScreenshotNeo also supports full-page captures with lazy images loaded, CSS-selector element capture, custom CSS and JavaScript, waits, request blocking, headers, cookies, user agents, timezone and geolocation, caching with your chosen TTL, signed links, asynchronous jobs with signed webhooks, bulk capture for up to 100 URLs per call, and PDF controls such as paper size, margins, orientation, and page ranges. Every feature is included on every plan: 1,000 screenshots per month free with no card, then $5 for 3,000, $15 for 15,000, $39 for 60,000, $99 for 250,000, or $249 for 1,000,000; annual billing gives two months free.
Best Value
- WHY CHOOSE CORE I3-10110U - Better single-core performance: The Core i3-10110U has a higher peak boost clock (4.1 GHz) compared to the Ryzen 3 4300U and the Intel Alder Lake N150 series, making it better for tasks that rely on fast single-core performance (e.g., web browsing, office apps). Better multi-thread performance via Hyper-Threading: the Core i3-10110U offers better performance in multi-threaded workloads compared to the Ryzen 3 4300U, especially for light productivity work and multitasking.
- 16GB RAM MEMORY & 512GB SSD STORAGE - GMKtec Nucbox G3 PRO mini pc is prebuilt with 16GB DDR4 RAM SO-DIMM DUAL CHANNEL, you will enjoy a speedier experience with Built-in 512GB M.2 Hard Drive. Our mini desktop pc boots up in seconds, work on multiple browser tabs, software applications and quickly transfers files. There is a primary slot and secondary expansion storage. Primary slot is M.2 2280 PCIE/SATA and secondary slot is M.2 2242 SATA .
- RICH INTERFACE - Nucbox core i3 mini computer is equipped with USB 3.2*4,up to 5Gbps/S, HDMI(4K@60Hz)×2, 3.5mm Audio Jack. Supports WiFi 6, and Gigabit Ethernet RJ45 2.5GbE network connectivity, Bluetooth 5.2. This Mini PC supports multiple device connection and can be used with servers, monitoring equipment, office equipment, displays, projectors, televisions, etc.
- 4K DUAL SCREEN DISPLAY - Mini desktop computer is equipped with upgraded Intel Graphics(max 1000MHz), supports 4K video playback and AV1 decoding, connect the pc with a projector as a home theatre, enjoy a variety of entertainments. Two HDMI 2.0 ports allows you to multi-task efficiently on two 4K@60Hz displays.
- UPGRADED COOLING FAN - The G3 PLUS has upgraded the cooling fan to reduce fan noise and thermals. We are using an upgraded thermal paste as well to help reduce heat on the CPU.
Create a free ScreenshotNeo account to get 1,000 screenshots a month without a card.
Final verification before shipping
- Save a representative HTML response and its assets.
- Run the pinned executable manually with stderr visible.
- Run the same command as the production service user.
- Confirm the output opens and the process returns zero.
- Restore the Django view, retain structured logs, and test a deployment rollback.
Frequently Asked Questions
Can a permissions problem cause exit status 1 even when HTML is valid?
Yes. The worker needs execute permission on the binary, read access to local assets, and write access to its temporary and destination directories. Check those permissions as the actual Gunicorn, uWSGI, Celery, or systemd user.
Why should the command line be preserved in incident logs?
The effective executable, input form, options, environment, and output path determine resource resolution. Without the exact command, a shell reproduction can silently use a different binary or base URL.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Is a hosted capture service suitable for private Django pages?
Only when the page is intentionally reachable by the service and protected appropriately. Do not expose confidential data merely to simplify rendering; use access controls and short-lived URLs.
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.

