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

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

Most Spatie Browsershot PDF failures occur before PDF layout is involved: the PHP process cannot find Node.js or Chrome/Chromium, a required package is missing, or Chrome refuses to start in the server environment. Diagnose the runtime chain from the same worker, container, or web service that generates the PDF, then check driver-specific configuration and only afterward tune PDF options.

What Browsershot is doing

Spatie Browsershot is a PHP wrapper around Puppeteer and headless Chrome/Chromium. Your application asks Browsershot to load trusted HTML or a URL; Puppeteer launches the browser, renders the page, and Chrome writes the PDF. A failure at any link can appear as a generic generation exception.

First establish whether you are calling Browsershot directly or using the Browsershot driver through Laravel PDF. They expose different configuration surfaces. Laravel PDF supports multiple backends and documents Browsershot as its default driver; that driver requires Node.js and Chrome or Chromium.

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

1. Capture the complete failure context

Do not diagnose from “PDF generation failed” alone. Record the complete exception, including the process output and any nested error. Also record:

#1 Best Overall
Corel PDF Fusion Software
  • Save money by using PDF Fusion to view over 100 file formats without having to purchase additional software
  • Merge incompatible files quickly and easily by dragging and dropping in PDF Fusion to create a new PDF documents
  • Save time with PDF Fusion's editing tools to reuse the content from existing documents without starting from scratch
  • Browsershot, Puppeteer, Laravel PDF, Laravel, PHP, Node.js and Chrome/Chromium versions.
  • Operating system or container base image.
  • The exact code path: browser startup, page loading, rendering, or file writing.
  • The binary paths and relevant Laravel PDF configuration.
  • Whether the same input succeeds from an interactive shell but fails in a queue worker, web request, scheduler, or container.

This information distinguishes a missing executable from a navigation timeout, an unsupported browser option, and a filesystem permission problem.

2. Verify the runtime from the failing process

Node.js and Chrome may be installed on the host but invisible to PHP-FPM, a queue worker, or a container. Check from the same service context that executes your code, not only from your own shell. Confirm that the executable is present, runnable, and on the account’s PATH.

Laravel PDF path settings

Inspect your Laravel PDF configuration and set the paths explicitly when the service environment does not inherit the expected PATH. The documented settings include:

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.
  • node_binary and npm_binary for Node and npm.
  • chrome_path for the Chrome/Chromium executable.
  • node_modules_path and bin_path for JavaScript dependencies and binaries.
  • include_path and temp_path for PHP include and temporary-file handling.

Use absolute paths appropriate to your image or host, clear Laravel’s cached configuration after changing them, and restart long-running workers. A path that works in a login shell is not proof that the PHP service can use it.

Rank #2
MixPad Free Multitrack Recording Studio and Music Mixing Software [Download]
  • Create a mix using audio, music and voice tracks and recordings.
  • Customize your tracks with amazing effects and helpful editing tools.
  • Use tools like the Beat Maker and Midi Creator.
  • Work efficiently by using Bookmarks and tools like Effect Chain, which allow you to apply multiple effects at a time
  • Use one of the many other NCH multimedia applications that are integrated with MixPad.

Direct Browsershot versus Laravel PDF

For direct Browsershot calls, configure the Browsershot instance itself. For Laravel PDF, configure the PDF package’s Browsershot driver and use its documented customization hooks. Mixing examples from the two APIs can leave the setting in a file that the active driver never reads.

3. Check the Laravel PDF v2 dependency and migration changes

Laravel PDF v2 treats spatie/browsershot as a suggested dependency. If you select the Browsershot driver, require that package explicitly in your application. An omitted dependency can surface as CouldNotGeneratePdf.

During a v1-to-v2 upgrade, the old getBrowsershot() customization method was removed. Use withBrowsershot() instead. Search your application and service providers for the removed method, update the customization, then reinstall or update dependencies consistently in the deployment environment.

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

4. Test Chrome launch restrictions

If Node starts but Chrome exits immediately, inspect sandbox restrictions, shared-memory limits, user permissions, and the container’s process policy. Laravel PDF exposes a no_sandbox option, and Spatie documents that it can be needed in Docker or other restricted environments.

Rank #3
DeskFX Free Audio Effects & Audio Enhancer Software [PC Download]
  • Transform audio playing via your speakers and headphones
  • Improve sound quality by adjusting it with effects
  • Take control over the sound playing through audio hardware

Do not enable no_sandbox as a universal remedy. It reduces a browser security boundary. Use it only when the deployment environment explains the launch failure, apply the narrowest container or user fix that works, and document the security trade-off. If the error is a missing binary, bad path, or failed page navigation, this option will not solve it.

5. Separate generation errors from PDF appearance problems

If a PDF file is created and opens, Browsershot has already completed the runtime chain. Investigate rendering options instead of changing executable paths.

Output and file writing

Use the documented savePdf() method or an output path with a .pdf extension. Ensure the destination directory exists and is writable by the PHP worker. A successful browser render can still fail when the final file cannot be created or replaced.

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

Page geometry and pagination

Check paper format or explicit page size, margins, orientation, scale, background printing, headers and footers, and page ranges. A CSS layout that looks correct in a browser viewport may paginate differently when margins, scale, or a different paper format are applied. Change one option at a time and compare the resulting file.

Rank #4
Single Use Temperature Data Logger with Light Sensor 10000 Points Capacity USB Interface for PDF Report Generation Software Free Configuration LED Indicator for Alarm Status and
  • Single Use Monitoring: This data logger is designed for one time use and features integrated light and temperature sensors to provide data collection with .
  • Software Free Configuration: The device supports online configuration without the requirement to install any software for a quick and easy setup process.
  • Integrated USB Connector: The plug and read design allows for direct connection to computers without the use of external cables or readers for access to recorded information.
  • Automated PDF Reports: Upon connection the device generates a comprehensive PDF report including temperature statistics in Celsius or Fahrenheit and alarm status for documentation.
  • High Capacity Recording: The unit stores up to 10000 temperature points and utilizes LED indicators to display recording information including alarm status and statistics.

Loading and timing

For pages that depend on JavaScript, wait for a reliable selector, a deliberate delay, or network idle before generating the PDF. If remote assets are required, verify that the worker can resolve DNS, establish TLS connections, and authenticate to those resources. A timeout during page loading is not fixed by changing paper size.

6. Use a minimal reproducible PDF

  1. Create a tiny trusted HTML document containing plain text and one local style.
  2. Render it through the same queue, web service, or container that fails in production.
  3. If it fails, focus on Node, Chrome, paths, permissions, sandboxing, and package versions.
  4. If it succeeds, add the real URL, external assets, JavaScript, authentication, and layout options one at a time.
  5. Keep the first input that breaks as the reproducible case for your issue report.

Spatie’s PDF guidance places responsibility on the caller to validate URLs and HTML passed to Browsershot. Pass only trusted inputs; do not turn an arbitrary user-supplied URL into a server-side browser request.

Common symptoms and targeted fixes

Symptom Likely cause Action
CouldNotGeneratePdf immediately Missing Browsershot dependency in Laravel PDF v2 or an unusable runtime path Require spatie/browsershot, verify configuration, and inspect the nested process error.
Works in a terminal, fails in a queue Different PATH, user, permissions, or working directory Set absolute paths and test from the worker/container context; restart workers.
Chrome closes at startup Sandbox or restricted-server policy Check container permissions and only then evaluate the documented no_sandbox setting.
Blank or incomplete PDF Page assets or JavaScript had not finished loading Wait for a selector, delay, or network-idle condition; check network access and asset errors.
Correct file, wrong pagination Paper size, margins, scale, orientation, or print-background settings Adjust PDF options deliberately and inspect page ranges and headers/footers.
Render succeeds but save fails Missing directory or write permission Use savePdf() or a .pdf path and grant the worker access to the destination.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

7. When switching drivers makes sense

Changing Laravel PDF drivers is an architectural choice, not an automatic fix for a Browsershot error. Compare the required runtime and layout features:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Driver or service Operational model When it may fit
DOMPDF PHP-only; no external browser binary Simple, mostly static documents where CSS and browser fidelity are limited.
Gotenberg Docker-based PDF API Teams that want browser rendering isolated as a service.
WeasyPrint Python-based executable Deployments prepared to operate its Python runtime and CSS engine.
Cloudflare Browser Run Remote browser API When a managed remote browser is acceptable.
Chrome driver Local Chrome/Chromium through chrome-php/chrome Applications that want direct local browser control.

Choose based on whether you can operate a local browser, a separate service, or a remote API, and on the PDF features your templates require. Preserve a minimal test document when evaluating a replacement.

Best Value
WavePad Audio Editing Software - Professional Audio and Music Editor for Anyone [Download]
  • Full-featured professional audio and music editor that lets you record and edit music, voice and other audio recordings
  • Add effects like echo, amplification, noise reduction, normalize, equalizer, envelope, reverb, echo, reverse and more
  • Supports all popular audio formats including, wav, mp3, vox, gsm, wma, real audio, au, aif, flac, ogg and more
  • Sound editing functions include cut, copy, paste, delete, insert, silence, auto-trim and more
  • Integrated VST plugin support gives professionals access to thousands of additional tools and effects

Or skip the browser setup

If your actual requirement is a dependable screenshot or PDF capture endpoint rather than maintaining Puppeteer and Chrome inside PHP, ScreenshotNeo makes one GET request and returns a PNG, JPEG, WebP, or PDF. It 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, CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status.

Use the API documentation at https://screenshotneo.com/docs/ for the complete option list, including full-page lazy-image loading, CSS-selector element capture, device presets, retina scale, PDF paper and margin controls, custom CSS and JavaScript, waits, request blocking, headers, cookies, user agent, timezone, geolocation, transparent backgrounds, resizing, TTL caching, signed links, asynchronous webhooks, bulk capture of up to 100 URLs per call, usage reporting, and OpenAPI.

cURL

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

PHP

<?php
$response = file_get_contents('https://api.screenshotneo.com/v1/shot?' . http_build_query([
    'access_key' => 'YOUR_API_KEY',
    'url' => 'https://stripe.com',
]));
file_put_contents('shot.webp', $response);

Python

import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)

Node.js

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

ScreenshotNeo includes an MCP server with take_screenshot, get_page_info, and capture_pdf for Claude, Cursor, and other MCP clients. The Free plan includes 1,000 shots per month without a card; paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account.

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.

What to include when asking for help

  • The full exception and process output, not only its final line.
  • Exact package, Puppeteer, Chrome/Chromium, Node.js, PHP, Laravel, and Laravel PDF versions.
  • Operating system or container image and the service account running PHP.
  • Configured executable, module, binary, include, temporary, and output paths.
  • The smallest trusted HTML or URL that reproduces the issue.
  • Whether failure occurs at startup, navigation, rendering, or file writing.

Without those details, “Browsershot error” is not specific enough to justify one exact fix.

Frequently Asked Questions

Why does Browsershot work locally but fail in Docker?

The container may lack Chrome, Node.js, required modules, executable permissions, shared resources, or the sandbox permissions available on your workstation. Test and configure paths inside the container and use no_sandbox only when its restrictions explain the startup failure.

Should I always enable no_sandbox?

No. It is an environment-specific setting for Docker or restricted servers and removes a browser security boundary. Fix paths, permissions, and container policy first.

Can I pass any URL to Browsershot?

No. Validate URLs and HTML and pass only trusted inputs, because the browser process can make server-side network requests.

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

Quick Recap

Bestseller No. 1
Bestseller No. 2
MixPad Free Multitrack Recording Studio and Music Mixing Software [Download]
MixPad Free Multitrack Recording Studio and Music Mixing Software [Download]
Create a mix using audio, music and voice tracks and recordings.; Customize your tracks with amazing effects and helpful editing tools.
Bestseller No. 3
DeskFX Free Audio Effects & Audio Enhancer Software [PC Download]
DeskFX Free Audio Effects & Audio Enhancer Software [PC Download]
Transform audio playing via your speakers and headphones; Improve sound quality by adjusting it with effects

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.