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

When Laravel PDF generation fails with wkhtmltopdf, first test the wkhtmltopdf executable from the same host or container, operating-system user, and deployment environment as PHP. Then make sure Laravel Snappy’s binary setting points to that exact executable. Snappy is the Laravel wrapper; it does not remove the need to install and run the separate renderer.

If the executable launches successfully, investigate missing system libraries, differences between local and production environments, the installed Qt build, and the HTML or JavaScript being rendered. The steps below isolate those causes before you change your Blade templates.

How Laravel Snappy and wkhtmltopdf fit together

Laravel Snappy connects Laravel to wkhtmltopdf. The wrapper supplies configuration and a way to request PDF generation; wkhtmltopdf is a separate program that must be present, executable, and compatible with the environment running PHP. Installing the Composer package alone does not guarantee that the renderer is installed or that Laravel can launch it.

That distinction helps narrow the fault:

  • If the shell cannot run wkhtmltopdf, investigate installation, permissions, libraries, or the host image before debugging Blade.
  • If the shell can convert a test file but Laravel cannot, compare the configured binary path, PHP process user, and runtime environment.
  • If the PDF is created but its layout or content is wrong, investigate the renderer build and the HTML/CSS/JavaScript it receives.

Why is wkhtmltopdf not found in Laravel?

1. Test the executable in the application environment

Open a shell on the machine or inside the container where the Laravel application runs, and use the same operating-system user as the PHP worker when possible. Run:

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • 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.
wkhtmltopdf --version

If the command is not found, locate the installed executable or install an appropriate build. Do not assume the shell’s search path or executable location is the same for PHP-FPM, a queue worker, a scheduled job, or a web-server process.

Next, test a small, known local HTML file. For example, create /tmp/wkhtmltopdf-test.html containing a simple heading and paragraph, then run:

wkhtmltopdf /tmp/wkhtmltopdf-test.html /tmp/wkhtmltopdf-test.pdf

Check whether the command exits successfully and whether the output PDF is readable. This separates a renderer or operating-system problem from Laravel-specific configuration. If your environment uses different temporary directories or access rules, choose paths the PHP process can read and write.

2. Match the Snappy binary path to the actual file

Open config/snappy.php and inspect the binary value. It must identify the executable installed in the running environment, not merely a path that exists on your development machine. Laravel Snappy’s documentation covers both downloaded binaries and Composer-provided binaries, whose paths can differ.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 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.

After changing configuration, make sure the running application is using the updated value. If your deployment caches Laravel configuration, clear or rebuild that cache using your normal deployment procedure. Then retry from the same web or queue execution path that originally failed.

3. Check execution permission and path quoting

The PHP process needs permission to execute the file, and the path must be passed correctly by the wrapper. A permission failure, including exit code 126 in some environments, can indicate that the file is not executable or that its filesystem is mounted with execution disabled.

  • Check the executable’s owner and permissions, and ensure the PHP runtime user can execute it.
  • For Vagrant setups, Laravel Snappy’s README advises moving the binary outside a synced folder when execution there fails.
  • On Windows, follow the path quoting format documented by the package; spaces in an executable path need particular care.

Why does the PDF work locally but fail on the server?

A successful local conversion does not establish that production has the same binary, operating-system libraries, fonts, architecture, runtime user, or permissions. Compare the environments rather than assuming that a copied executable is self-contained.

Look for missing shared libraries

Read the process error for a named missing library, then install the corresponding package in the same operating-system image that runs PHP. Laravel Snappy’s README gives libXrender as an example of a dependency that may be absent. The wkhtmltopdf downloads page also explains that static Qt builds still rely on some system packages; “static” does not mean every required library is bundled.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • 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.

Install dependencies in the final deployment image, not only in a temporary build stage that is discarded before runtime. Retest the command inside the final container or host and under the application’s runtime user.

Compare the deployment conditions

Record and compare these items between local and production:

  • Operating system and distribution version
  • CPU architecture and the build selected for it
  • wkhtmltopdf version and build characteristics
  • Installed shared libraries and fonts
  • Executable path, file permissions, and runtime user
  • PHP process environment, including filesystem and temporary-directory access

The official downloads page lists builds by distribution and architecture and notes that compatibility depends on system libraries. Use a build intended for the production environment; a binary that happens to work on a laptop may not be suitable for a container or another distribution.

Why are headers, footers, outlines, or table of contents missing?

Check which wkhtmltopdf build is actually installed. The project’s downloads page warns that some features require patched Qt, while distribution maintainers may compile builds without those features. A command-line option being accepted in one build does not prove that the same feature is implemented in another.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • 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

The command-line manual documents header and footer options, including text and HTML variants, and notes that outlines require patched Qt. If these features fail, verify the build before rewriting templates or assuming Laravel Snappy is dropping the settings. The distinction is especially important when local and production use packages from different sources.

Why does the PDF layout or CSS differ from a browser?

wkhtmltopdf uses an older Qt/WebKit lineage, so modern browser rendering is not a reliable preview of its output. The project status page says Qt 4 has not been supported since 2015 and that its WebKit had not been updated since 2012. Treat rendering-engine limitations as a possible cause when CSS or JavaScript behaves differently; changing Laravel configuration will not update the renderer’s browser engine.

Check page geometry and scaling

Reduce the document to a minimal HTML example and verify the paper size, margins, viewport settings, zoom, and smart-shrinking behavior. Unexpected scaling can come from page geometry or smart shrinking rather than from the template’s CSS alone. Change one setting at a time and compare output PDFs so the effect is clear.

Wait for required JavaScript work

Do not assume wkhtmltopdf waits for every application-specific asynchronous operation. For a controlled test, set a known window status value in JavaScript only after the content needed for the PDF is ready, then use the documented --window-status option to wait for that value. If the status is set too early, or never set, the result will not establish that all application work completed. Keep the test page minimal so timing behavior is easier to isolate.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 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.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Handle generated HTML as a security boundary

The wkhtmltopdf project’s status page 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 on which it is running!” Treat HTML and JavaScript sent to the renderer as potentially dangerous input, not merely document content.

  • Sanitize user-supplied markup and scripts before rendering.
  • Keep document generation isolated from sensitive application resources and credentials as appropriate for your deployment.
  • Do not let a user provide arbitrary HTML or JavaScript to a privileged renderer process without a security review.

Should you keep wkhtmltopdf or choose another renderer?

The right choice depends on the document’s rendering requirements and the environment you can safely operate. The project identifies an old rendering lineage and build-dependent feature support; the reviewed project material does not establish current performance, feature parity, cost, or maintenance status for alternative renderers. Evaluate alternatives against your own requirements rather than assuming a universal winner.

  • Rendering fidelity: Does the output depend on modern CSS or JavaScript behavior that this older Qt/WebKit lineage may not support?
  • Special features: Do you need headers, footers, outlines, or other functions that may depend on patched Qt?
  • Deployment compatibility: Is there a suitable build for your production distribution and architecture, with required libraries and fonts available?
  • Security model: Can you sanitize and isolate the HTML and scripts processed by the renderer?
  • Operational burden: Can your team maintain the necessary native libraries or, for a different renderer, any browser runtime it requires?

The project page calls 0.12.6 the stable series and gives its release date as June 11, 2020. That is useful version context, not evidence that the underlying rendering engine is modern or actively maintained. Assess whether the version and rendering behavior meet your security and compatibility needs.

Make a useful, reproducible bug report

If the failure remains, provide enough detail for another developer to reproduce it without access to your application. The wkhtmltopdf project asks for the version, operating system/version, and a detailed test case.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Include the exact wkhtmltopdf version and identify the build if known.
  2. State the operating system and version, plus relevant deployment details such as container distribution and architecture.
  3. Provide a minimal HTML/CSS/JavaScript example that reproduces the result, removing confidential data.
  4. Include the command or relevant wrapper options, the full error output, and whether a small shell conversion succeeds.
  5. Describe the observed output and the expected output, especially for timing, headers, footers, or scaling issues.

Or skip the browser setup

If your actual need is a clean screenshot of a web page rather than a PDF generated by Laravel, ScreenshotNeo can return an image with one GET request. It is not a drop-in replacement for wkhtmltopdf when you need PDFs or Laravel’s PDF-generation workflow. ScreenshotNeo is a separate website screenshot API and MCP server; its clean-shot process accepts consent banners and removes known consent platforms, newsletter popups, and chat widgets before capture. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and responses identify the page verdict and billing status in headers. AI agents can use its MCP server tools.

For example, save a screenshot as WebP with cURL:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo API documentation for the request options and response details. Free includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000. Sign up for ScreenshotNeo’s free plan.

Frequently asked questions

Does installing Laravel Snappy install wkhtmltopdf?

No. Snappy is the Laravel wrapper; wkhtmltopdf is a separate executable that must be installed and accessible to the running application.

Does ScreenshotNeo generate PDFs for a Laravel app?

No. It is a website screenshot service returning image formats or PDFs through its own API, not a replacement for integrating wkhtmltopdf into Laravel. Use it when the requirement is a remote website capture rather than rendering application documents through Snappy.

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.

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.