Use Laravel’s HTTP client to POST a publicly reachable page URL (or an HTML string) to https://api.html2pdf.app/v1/generate, authenticate with the X-API-Key header, check for a successful status, and return the response body as PDF bytes. Keep the API key on the server. For short conversions, a synchronous download is the simplest path; use a callback for work that may outlast a web request.
Configure the API key on the server
Store the key in an environment variable, not in a Blade template, browser JavaScript, or a public repository. Add a service entry in config/services.php:
As an Amazon Associate I earn from qualifying purchases.
'html2pdf' => [
'key' => env('HTML2PDF_API_KEY'),
],
Set HTML2PDF_API_KEY in the environment used by the Laravel application, then read it with config('services.html2pdf.key'). In production, use your deployment platform’s secret management and refresh Laravel’s configuration cache after changing environment-backed configuration.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Generate and download a PDF synchronously
This route submits a public URL for conversion. A successful response contains the PDF itself, not JSON; the status check prevents an upstream error page from being mislabeled as a PDF.
#1 Best Overall
- INNOVATIVE CARTRIDGE-FREE PRINTING — No more dealing with lots of tiny ink cartridges; With this wireless document and photo printer each ink bottle set is equivalent to about 90 individual cartridges²
- LESS FREQUENT INK REPLACEMENT — Replacement ink bottles don't have to be changed nearly as often as ink cartridges¹; When you choose this combination printer, scanner and copier you can print up to 4,500 pages black/7,500 color³
- COLOR PRINTING — Up to 2 years of ink in the box4 (and with every replacement ink set) for fewer out-of-ink frustrations
- ZERO CARTRIDGE WASTE — By using an Epson EcoTank printer you can help reduce the amount of cartridge waste ending up in landfills
- HOME PRINTER DESIGNED FOR RELIABILITY — The Epson EcoTank ET-2800 All-in-One Supertank Color Printer creates vivid, detailed prints and documents thanks to Micro Piezo Heat-Free Technology; Fire off 10 ISO pages per minute1 to easily finish large jobs
use IlluminateSupportFacadesHttp;
use IlluminateSupportFacadesRoute;
Route::get('/reports/website.pdf', function () {
$response = Http::withHeaders([
'X-API-Key' => config('services.html2pdf.key'),
])->post('https://api.html2pdf.app/v1/generate', [
'html' => 'https://example.com/report',
]);
if (! $response->successful()) {
// Log useful diagnostics privately; do not return the upstream body as a PDF.
report(new RuntimeException(
'Html2Pdf.app returned HTTP '.$response->status()
));
abort(502, 'PDF generation failed.');
}
return response()->streamDownload(
fn () => print($response->body()),
'report.pdf',
['Content-Type' => 'application/pdf']
);
});
The example uses Laravel’s HTTP client response body and status facilities and Laravel’s streamDownload response. The response is already held in memory by the HTTP client, so streaming it to the browser does not make the upstream transfer itself incremental. For large files or substantial traffic, write results to managed storage or move conversion to queued background work rather than tying up a web request. See the Laravel 12.x response documentation and HTTP client response API.
Send raw HTML instead of a URL
The required request field is html; it can contain a public URL or raw HTML. For example, render a view and send the resulting string:
$html = view('pdf.report', ['report' => $report])->render();
$response = Http::withHeaders([
'X-API-Key' => config('services.html2pdf.key'),
])->post('https://api.html2pdf.app/v1/generate', [
'html' => $html,
]);
Apply the same status check and binary-response handling as in the route example. Do not assume that a URL requiring your application’s login session will be accessible to the conversion service; URL-based rendering requires a publicly reachable source.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Rank #2
- CARTRIDGE-FREE PRINTING — Print lab-quality photos, graphics and creative projects; Get vibrant colors and sharp text with Epson's high-accuracy printhead and Claria ET Premium 6-color inks
- INK BOTTLES — Save on photos1 and creative projects with affordable in-house printing; All-in-one printer allows you to print 4" x 6" photos for about 4 cents each vs. 40 cents with traditional ink cartridges1
- LESS FREQUENT INK REPLACEMENT — Replacement ink bottles don't have to be changed nearly as often as ink cartridges¹; Printer, scanner and copier lets you print up to 6,200 color pages³
- PRINT FOR LONGER — Up to 2 years of ink in the box² (and with every replacement ink set) for fewer out-of-ink frustrations with this wireless printer
- ZERO CARTRIDGE WASTE — Epson EcoTank printer helps reduce the amount of cartridge waste ending up in landfills; Cartridge-free printer uses high-yield ink bottles; Each replacement ink bottle set is equivalent to about 100 individual ink cartridges⁴
Choose synchronous or callback generation
| Flow | Use it when | Implementation considerations |
|---|---|---|
| Synchronous | The conversion usually finishes within your web request timeout and the user needs the file immediately. | Check the HTTP status and return the successful binary body. Account for the time the upstream conversion takes and the memory used by the response. |
| Callback | Longer generation makes a user-facing request or server timeout unsuitable. | Submit callBackUrl and an optional correlation state. The initial accepted request returns HTTP 202; process the later callback, decode its base64 document, and make handling idempotent because failed delivery can be retried up to three times. |
Handle a callback safely
- Create a durable job record and a unique
statevalue before submitting the conversion. Associate that value with the requesting user or report. - Include your callback endpoint in
callBackUrland the correlation value instate, following the API’s exact request format in the Html2Pdf.app documentation. - When the callback arrives, validate it according to the vendor’s documented callback contract, find the job by
state, and reject or quarantine callbacks that cannot be matched. - Decode the base64-encoded
document, verify it is non-empty and process it once. Use a processed marker or unique job constraint so a retry does not create duplicate files or repeat side effects. - Store the PDF or mark the job complete, then let the user retrieve it through an authorized application route.
The callback changes the workflow from “return the PDF in this request” to “accept a job, then receive the result later.” Keep callback processing short and move storage or other slow work to a queue.
Control rendering with request options
The API supports layout options including format, landscape, width, height, margins, and media set to screen or print. Pass options in the request as documented and verify the supported values and exact parameter names in the current API reference before depending on less common settings. The rendering result can change with media selection, available fonts and other fetched resources, and JavaScript load timing.
Test the page and protect its data
- Confirm a URL is reachable without an interactive login from outside your application before submitting it.
- Check representative output for missing styles, images, fonts, or content rendered by JavaScript; test the page variants your users will actually convert.
- Do not put secrets in source URLs or markup unless your own security and privacy review permits it.
- Html2Pdf.app says generated PDFs are processed temporarily rather than permanently stored, raw HTML/text is not stored in conversion logs, and selected request metadata plus a source URL may be retained in logs. These are vendor statements, not an independent audit. Review its documentation and linked privacy and data-processing terms for your use case.
Fix common failures
| Symptom or status | Likely cause | What to do |
|---|---|---|
| 400 response | Invalid input or inaccessible source URL. | Check the required html field and request options; confirm the URL is publicly reachable. Correct the request before trying again. |
| 401 response | Missing or invalid API key. | Check the server secret and X-API-Key header. Keep the key out of client code. |
| 403 response | Plan limit or restriction. | Review current account usage and plan limits before resubmitting. |
| 500 response | Unhandled service-side error. | The vendor recommends retrying after a short delay with increasing delays; contact support if it persists. Avoid an unbounded retry loop. |
| Blank PDF or missing styles/resources | The source or its CSS, fonts, or images could not be fetched, or JavaScript had not produced the expected content when captured. | Check public reachability and resource access, and test the page with the appropriate media setting and timing. |
| A file named .pdf contains an error page | The application wrote or served a non-success response as though it were a PDF. | Check the status before accessing the body as a file; log the upstream status privately and return an application error instead. |
The vendor documents 400, 401, 403, and 500 as relevant error statuses. Do not retry 400, 401, or 403 until the input, credentials, or plan issue is corrected. Further implementation details and PHP examples are in the Html2Pdf.app PHP examples.
Rank #3
- SET IT UP ONCE AND PRINT WITH CONFIDENCE. No complicated maintenance. Just easy, reliable printing you can count on.
- INK FOR YEARS. NOT MONTHS. Up to 2 years of ink included. Get thousands of pages of cartridge-free printing. More pages, less hassle
- KEEPS PRINTING WELL AFTER COMPETITORS HAVE QUIT. No complex maintenance. Sharper text, richer colors.[2] Only with HP Smart Tank
- PREMIUM SUPPORT - Strong technical expertise to solve issues faster
- THE LAST PRINTER YOU'LL EVER NEED. Enjoy years of refillable, cartridge-free printing.
Estimate plan capacity before shipping
Html2Pdf.app’s live pricing page, accessed October 3, 2026, lists the following terms. Prices and quotas can change, so confirm them on the current pricing page before budgeting. The vendor says each 5 MB chunk of generated PDF consumes one credit and credits reset on the first day of the month.
| Plan | Published price | Credits per month | Parallel conversions | PDF size limit |
|---|---|---|---|---|
| Free | $0 | 100 | 1 | Up to 1 MB |
| Startup | $9/month | 1,000 | 3 | Unlimited |
| Standard | $25/month | 5,000 | 10 | Unlimited |
| Scale | $39/month | 10,000 | 20 | Unlimited |
Or skip the browser setup
If your Laravel job is to capture a website as an image or PDF rather than convert HTML into a PDF, ScreenshotNeo offers a website screenshot API and MCP server. One GET request can return a PNG, JPEG, WebP, or PDF; it is not a drop-in replacement for Html2Pdf.app’s HTML-to-PDF workflow. Its clean-shot steps accept cookie/consent banners and remove more than 60 known consent platforms, newsletter popups, and chat widgets before capture, and each step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed; responses identify the page verdict and billing status in headers. An MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents.
For a Laravel server-side request, keep the access key in backend configuration, not a public template:
use IlluminateSupportFacadesHttp;
$response = Http::get('https://api.screenshotneo.com/v1/shot', [
'access_key' => config('services.screenshotneo.key'),
'url' => 'https://stripe.com',
]);
See the ScreenshotNeo API documentation for response handling and options. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000. Sign up for the free plan.
Rank #4
- Wireless Bluetooth Printer: Portable thermal printer compatible with iPhone, Android phones, iPad and tablet computers via Bluetooth. For smartphones, please download the "Nada Print" App. You can also connect to laptops and computers for printing using a USB-C cable. (Note: Laptops and computers can only be connected via USB and require the installation of a driver first. Bluetooth connection is not supported.)
- No-ink printing: Only supports US Letter and A4 size thermal paper.(Doesn't support regular paper) The no-ink portable thermal printer uses direct thermal technology, requiring no ink, toner or ribbons, making it environmentally friendly, cost-effective and time-saving. The thermal printer package comes with a roll of US Letter thermal printing paper. Note: When installing the paper, remember to switch the paper size switch on APP
- Clear Print: NDYIN N80 portable thermal printer adopts high-definition printing technology, with a 203DPI resolution to provide you with clear printing results. This mobile printer is compatible with roll paper, folded paper and tattoo transfer paper, supporting printing from your mobile phone PDF, Word, pictures and web pages anytime and anywhere. It is recommended to use our NDYIN thermal paper to achieve good printing quality
- Portable wireless printer for travel: The thermal printer is equipped with a built-in 1500mAh rechargeable battery, which can print 160 sheets of 8.5" x 11" thermal paper after being fully charged. It weighs only 1.5 pounds and is compact in size. This ink-free portable printer can be easily carried in a backpack or briefcase! It is perfect for business travel, cars, small offices, construction sites, schools and homes. You can print documents, contracts, invoices and boarding passes anytime and anywhere
- The N80 thermal printer has a wide range of uses. The package includes the N80 printer, a roll of US Letter paper(7m/roll), a user manual, a guide card, a type-C soft cable and a type C adapter. Note: The charging adapter is not included. Special thermal paper is required for use; ordinary paper cannot be used. This ink-free portable thermal printer is suitable for various scenarios such as home, school, travel, office, and outdoor, meeting the printing needs of different groups of people. This tattoo template printer is also compatible with tattoo transfer paper, making it an ideal choice for tattoo art
Frequently Asked Questions
Does the synchronous Html2Pdf.app endpoint return JSON?
No. A successful synchronous generation returns PDF bytes; check the status before treating the response body as a PDF.
Can I convert a page that requires my Laravel login session?
URL-based conversion requires the submitted URL to be publicly reachable. For protected content, review the API’s supported request options and your data-handling requirements rather than assuming the converter shares the user’s session.
Can I use ScreenshotNeo to convert an HTML string into a PDF?
ScreenshotNeo is for capturing websites as screenshots or PDFs. It is not a drop-in HTML-string-to-PDF converter.
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.




