Use Laravel’s HTTP client to POST a public webpage URL in the html field to Html2Pdf.app’s PDF endpoint, authenticate with an X-API-Key, check the response status, then stream the returned PDF bytes to the browser. Keep the API key on the server. For long conversions, use the service’s callback flow instead of holding a web request open.
Configure the API key in Laravel
Store the key in a server-side environment variable, not in a Blade template, browser JavaScript, or a public repository. For example, add this to the deployment environment or local .env file:
HTML2PDF_API_KEY=your_api_key
Expose it through Laravel configuration, such as in config/services.php:
'html2pdf' => [
'key' => env('HTML2PDF_API_KEY'),
],
Then retrieve it with config('services.html2pdf.key'). After changing configuration in a production deployment that uses cached configuration, refresh that cache as part of the deployment process.
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 →#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
Generate and download a website PDF synchronously
The endpoint is POST https://api.html2pdf.app/v1/generate. Send the target URL as the value of the required html field and include the API key in the X-API-Key header. On success, the response body is PDF data, not JSON. This Laravel pattern checks for success before returning a PDF download:
<?php
namespace AppHttpControllers;
use IlluminateSupportFacadesHttp;
class WebsitePdfController
{
public function download()
{
$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 the upstream status for diagnosis, but do not expose its body
// as a PDF or return sensitive upstream details to the visitor.
abort(502, 'PDF generation failed.');
}
return response()->streamDownload(
fn () => print($response->body()),
'report.pdf',
['Content-Type' => 'application/pdf']
);
}
}
Wire the controller to a route appropriate to your application, then request that route to trigger generation. The sample is an integration pattern using Html2Pdf.app’s API contract and Laravel response facilities; it is not presented as a vendor-published Laravel code sample. Laravel documents streamed download responses and its HTTP client exposes methods for reading the response body and status.
Send rendered HTML instead of a URL
The html field can contain raw HTML as well as a public URL. Replace the URL value with the HTML string you want converted. Include or otherwise make available the CSS, fonts, images and other resources required by that markup; inaccessible resources can produce incomplete output.
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⁴
Set rendering options when needed
The API supports options including format, landscape, width, height, margins and media set to screen or print. Consult the current API documentation for parameter names and constraints before adding options to a production request. The media choice matters when a site uses different CSS for screen and print.
Recommended Free Tools
Choose synchronous generation or a callback
| Flow | Use it when | What your application handles |
|---|---|---|
| Synchronous | The PDF completes within the time available for the web request and the visitor should receive it immediately. | Check the HTTP status and return the successful binary response as a PDF download. |
| Callback | Generation may take too long for a visitor-facing request to wait safely. | Provide callBackUrl and optionally a correlation state; accept the later callback, decode its base64 document, and associate it with the right job. |
With callBackUrl, Html2Pdf.app switches to asynchronous generation. The initial accepted request returns HTTP 202; the service later POSTs JSON containing the PDF as a base64-encoded document. Use a unique state value to map that result to your queued job. Make the webhook idempotent because the service says failed callback delivery can be retried up to three times. Validate the callback and decoded content before storing or serving it.
Make the conversion dependable
- Ensure URL reachability: the URL supplied for URL-based conversion must be publicly reachable by the service. A route available only behind your login, VPN, or local development server will not work as an external source.
- Check dependencies: CSS, fonts and images need to be fetchable by the renderer. Test representative pages rather than assuming browser-visible resources will all load in conversion.
- Account for rendering differences: media selection, available fonts and resources, and JavaScript load timing can change the resulting layout. Test pages with charts, delayed content, or print-specific CSS carefully.
- Avoid excess synchronous work: the synchronous example retains the response body in application memory before streaming it. For large PDFs or high-volume use, consider background jobs and managed storage rather than tying up a web request.
- Keep secrets out of source content: do not place credentials or private tokens in source URLs or markup unless your security and privacy review explicitly permits it.
Troubleshoot errors and blank output
| Symptom or status | Likely cause | What to do |
|---|---|---|
| 400 Bad Request | Invalid input or an inaccessible source URL. | Check the required html field, option values and public reachability of the URL. |
| 401 Unauthorized | The API key is missing or invalid. | Confirm the server environment variable is populated, Laravel configuration resolves it, and the request sends it as X-API-Key. |
| 403 Forbidden | The account has reached a plan limit. | Check usage and the plan’s current limits before retrying. |
| 500 Internal Server Error | An unhandled service-side error. | The vendor recommends retrying after a short delay with increasing delays; contact support if it persists. |
| Blank page, missing styles, fonts, or images | The renderer cannot reach the page or its resources, or the page has different media rules or JavaScript timing. | Verify the URL and dependencies are public, test screen versus print media where relevant, and allow dynamic content to render as required. |
| A non-PDF file is downloaded as a PDF | The application returned an error response body without checking status. | Check for success before setting application/pdf; log status safely and report a controlled application error instead. |
Do not retry 400, 401, or 403 responses without correcting the input, credentials, or plan issue. See the vendor’s documented status codes and PHP examples and troubleshooting notes for details. The vendor’s PHP/cURL examples require PHP 8.1+ and cURL; the Laravel HTTP-client approach above uses Laravel’s client instead.
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.
Understand credits, concurrency, and data handling
Html2Pdf.app’s live pricing page, accessed October 3, 2026, lists these terms. Prices and quotas can change, so confirm them on the current pricing page before budgeting.
| Plan | Price listed | Credits/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 |
The same live pricing page states that each 5 MB chunk of generated PDF consumes one credit and that credits reset on the first day of the month. A synchronous design is straightforward for a small number of short jobs, but plan concurrency and request timeouts become important as traffic or document size grows; queueing work and using callbacks can keep slow conversions out of the visitor’s request path.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Html2Pdf.app says generated PDFs are processed temporarily rather than permanently stored on its servers, that raw HTML/text is not stored in conversion logs, and that selected request metadata and a source URL may be retained in logs. Those are the vendor’s own descriptions, not an independent audit. If documents contain personal, confidential, or regulated information, review the service’s linked Privacy Policy and Data Processing Agreement and your organization’s requirements before sending content.
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
Or skip the browser setup
If your goal is to capture a website as a PDF without setting up a browser renderer, ScreenshotNeo provides a website screenshot API with PDF output. Its API accepts one GET request and returns a PDF or an image; for example, save a rendered page as PDF with cURL:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -d format=pdf -o page.pdf
See the ScreenshotNeo API documentation for supported parameters. Cookie banners are accepted like a visitor and removed along with known consent platforms, newsletter popups and chat widgets before capture; each cleanup step can be turned off. Bot checks, blank pages, timeouts, failed loads and cache hits are not billed, and response headers report the page verdict and billing status. An MCP server offers screenshot and PDF tools for AI agents. The free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots.
Sign up for ScreenshotNeo’s free plan to try 1,000 screenshots a month with no card.
Frequently Asked Questions
Does Html2Pdf.app return JSON for a successful PDF request?
No. The successful synchronous response is PDF bytes; check the status before treating the body as a file.
Can I use Html2Pdf.app with HTML generated by Laravel?
Yes. Send the rendered markup as the required html field instead of a public URL, and ensure referenced resources are accessible.
Can a page behind authentication be converted from its URL?
The submitted URL must be publicly reachable for URL-based conversion. For private content, review the API’s supported request options and your security requirements before choosing a flow.
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.

