Use Laravel Snappy’s PDF::loadFile($url) to ask wkhtmltopdf to fetch a webpage and return it as an inline PDF or a download. You need both the Laravel package and a working wkhtmltopdf executable on the server. Because the renderer makes a server-side request to the URL, restrict which destinations your application accepts; do not expose an unrestricted URL-to-PDF endpoint.
Install Laravel Snappy and wkhtmltopdf
Install the Laravel integration with Composer:
composer require barryvdh/laravel-snappy
Laravel Snappy is a wrapper around KnpLabs Snappy, which invokes the separate wkhtmltopdf executable. Install wkhtmltopdf for the operating system and architecture used by your deployment, then verify that the binary runs from the command line. The package README documents publishing its configuration with Artisan and configuring the binary path in config/snappy.php, including examples for system and Composer-installed binaries. Check that the configured path is correct in each environment and that the application process has permission to execute it. See the Laravel Snappy README and the KnpLabs Snappy README.
Load a URL and return the PDF
With the PDF facade available in your project, the basic inline response is:
return PDF::loadFile($url)->inline('page.pdf');
To have the browser download the result instead, use:
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Clear out junk files and repair common Windows errors3Scan for outdated or missing drivers - takes under a minute#1 Best Overall
- PORTABLE SCANNER FOR USE ON-THE-GO — The fastest and lightest mobile single-sheet-fed compact document scanner in its class¹
- QUICK DOCUMENT SCANNING ― This Epson ultra-fast scanner scans a single page as quickly as 5.5 seconds²; Windows and Mac compatible
- VERSATILE PAPER HANDLING ― Portable scanner scans documents up to 8.5 x 72 in; Also easily digitizes receipts and ID cards to make accounting, bookkeeping, and organizing simpler
- INTUITIVE, HIGH-SPEED SOFTWARE — Epson ScanSmart Software³ is a smart tool allowing you to easily scan, review, and save; Stay organized easily with the help of this Epson scanner
- EASY SETUP — USB-powered connect to your computer for quick and simple scanning; No batteries or external power supply required to operate portable document scanner; Standard Connectivity: USB 2.0
return PDF::loadFile($url)->download('page.pdf');
For example, in a controller action whose URL has already been validated:
public function pdf(Request $request)
{
$url = $request->query('url');
// Validate and constrain $url before passing it to the renderer.
return PDF::loadFile($url)->inline('page.pdf');
}
The facade alias and service-provider setup can depend on the Laravel project configuration; consult the package README if PDF is not available. The lower-level service can also generate a file at a path:
Rank #2
- FAST SPEEDS - Scans color and black and white documents a blazing speed up to 16ppm (1). Color scanning won’t slow you down as the color scan speed is the same as the black and white scan speed.
- ULTRA COMPACT – At less than 1 foot in length and only about 1. 5lbs in weight you can fit this device virtually anywhere (a bag, a purse, even a pocket).
- READY WHENEVER YOU ARE – The DS-640 mobile scanner is powered via an included micro USB 3. 0 cable allowing you to use it even where there is no outlet available. Plug it into you PC or laptop and you are ready to scan.
- WORKS YOUR WAY – Use the Brother free iPrint&Scan desktop app for scanning to multiple “Scan-to” destinations like PC, Network, cloud services, Email and OCR. (2) Supports Windows, Mac and Linux and TWAIN/WIA for PC/ICA for Mac/SANE drivers. (3)
- OPTIMIZE IMAGES AND TEXT – Automatic color detection/adjustment, image rotation (PC only), bleed through prevention/background removal, text enhancement, color drop to enhance scans. Software suite includes document management and OCR software. (4)
$snappy = App::make('snappy.pdf');
$snappy->generate('https://example.com', storage_path('app/page.pdf'));
KnpLabs Snappy also documents retrieving generated output and returning it with Content-Type: application/pdf and Content-Disposition response headers. That is useful when you need to construct a response explicitly rather than use the wrapper’s inline() or download() helpers.
Set paper size, orientation and margins
Laravel Snappy passes layout settings through to wkhtmltopdf. For example:
Rank #3
- STAY ORGANIZED – Easily convert your paper documents into digital formats like searchable PDF files, JPEGs, and more.Power Consumption : 2.5W or less (Energy Saving Mode: 0.7W). Suggested Daily Volume : 500 scans..Does it contain liquid: no
- CONVENIENT AND PORTABLE –lightweight and small in size, you can take the scanner anywhere from home offices, classrooms, remote offices, and anywhere in between
- HANDLES VARIOUS MEDIA TYPES – Digitize receipts, business cards, plastic or embossed cards, reports, legal documents, and more
- FAST AND EFFICIENT – No technical hurdles or complicated setups here; easily scan both sides of a document at the same time, in color or black-and-white, at up to 12 pages-per-minute, and with a 20 sheet automatic feeder
- BROAD COMPATIBILITY – Works with both Windows and Mac devices, be it laptop or computer
return PDF::loadFile($url)
->setPaper('a4')
->setOrientation('landscape')
->setOption('margin-bottom', 0)
->inline('page.pdf');
The wkhtmltopdf manual lists A4 as its default paper size, portrait as its default orientation, and 10 mm defaults for left and right margins. It also documents renderer options such as JavaScript delay, load-error handling, print-media mode, headers and footers. Defaults and accepted options belong to the binary actually deployed, so check the wkhtmltopdf usage manual when adjusting layout or load behavior.
What happens when Snappy loads a webpage
loadFile() causes the renderer process on your Laravel host to fetch and process the page; it is not Laravel rendering a Blade view. The host must be able to reach the destination, and stylesheets, images, fonts and other assets must also be reachable by the renderer. A URL that works in a user’s browser may still fail from the server because of network access, authentication, redirects, bot checks, or client-side JavaScript behavior. The package documentation supports URL inputs and configurable cookies, headers and proxy options, but does not guarantee how a particular website will behave. Test against the target environment.
Rank #4
- IRIScan Express, portable scanner : scans color and black and white documents a blazing speed up to 8ppm simplex. Color scanning won’t slow you down as the color scan speed is the same as the black and white scan speed.
- IRIScan Express mobile scanner is powered via an included micro USB 2. 0 cable allowing you to use it even where there is no outlet available. Plug it into you PC or laptop and you are ready to scan. USB cable provided. AC Adapter not provided and not needed.
- IRIScan flatbed scanner uses a simplex scanning mode allows for quick and straightforward scanning of single-sided documents. IRIScan with its full portable features is the ideal document scanners for computers.
- IRIScan document scanner : Versatile scanning capabilities, including scanning to Word, PDF, and Excel formats with companion software provided Readiris OCR
- Receipt scanner and card scanner with Additional features include scanning business cards directly to Outlook, photo scanning, and receipt scanning for efficient document management
Protect URL-to-PDF endpoints
An endpoint that accepts a URL and makes the server fetch it creates server-side network access on behalf of the caller. Do not pass arbitrary user-supplied destinations directly to wkhtmltopdf. Validate the URL and, where the feature permits, allowlist the hosts the application is meant to render. Treat redirects and resolved destinations as part of the decision: a permitted public URL should not be allowed to redirect the renderer to internal or sensitive network addresses. The reviewed package documentation does not provide a complete Laravel-specific allowlist implementation.
Be especially cautious with untrusted HTML and JavaScript. KnpLabs Snappy warns that wkhtmltopdf’s --enable-local-file-access option can be risky with untrusted content. The renderer manual says local-file access is disabled by default for conversions of local files unless paths are explicitly allowed; do not enable it merely to make an asset load without understanding the exposure. Avoid processing untrusted markup casually, sanitize inputs when applicable, and isolate the renderer process. The KnpLabs Snappy README recommends avoiding local-file access unless needed and using sandboxing such as AppArmor or SELinux.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Best Value
- Scanner type: Document
- Connectivity technology: USB
- With Auto Scan Mode, the scanner automatically detects what you're scanning
- Digitize documents and images
When wkhtmltopdf may be the wrong renderer
The wkhtmltopdf project’s status page notes that its Qt 4 base has not been supported since 2015 and its WebKit has not been updated since 2012. It cautions against using wkhtmltopdf with untrusted HTML and points to WeasyPrint or commercial Prince for controlled report generation, and Puppeteer for sites that rely on dynamic JavaScript. These are recommendations from the project maintainer, not a current independent comparison of capabilities or prices. Check the alternatives’ present support, deployment requirements and security model before migrating. See the wkhtmltopdf status page.
Troubleshoot common failures
- Binary not found or cannot execute: confirm wkhtmltopdf is installed on the server, set the correct
binarypath inconfig/snappy.php, and ensure the PHP/application user can execute it. - PDF is blank or a page fails to load: verify that the application host can reach the URL and its assets. Check the renderer’s output and relevant load-error options in the manual; test whether the page depends on JavaScript or access unavailable to the server.
- Layout differs from the browser: confirm the paper size, orientation and margins, then check whether the page uses print-specific styles or browser features unsupported by the deployed wkhtmltopdf engine.
- Images or stylesheets are missing: check that asset URLs are accessible from the server-rendering process. Do not enable local-file access as a shortcut without assessing the security consequences.
- Protected page cannot be rendered: determine whether the destination requires authentication, cookies or headers; Snappy exposes related renderer options, but the target site’s behavior must be tested.
Or skip the browser setup
If the goal is a screenshot or PDF of a live page rather than specifically running wkhtmltopdf inside Laravel, ScreenshotNeo offers a URL-based screenshot API and MCP server. Its one-call API can return a PDF; see the API documentation.
Quick Recap
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o page.pdf
Set the output filename to match the format requested by your API call. ScreenshotNeo removes cookie/consent banners, newsletter popups and chat widgets before capture; bot checks, blank pages and failed loads are not billed. Its MCP server lets AI agents use screenshot tools. The Free plan includes 1,000 screenshots a month with no card required; paid plans start at $5 for 3,000 screenshots. Sign up for the free plan.
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.

