dompdf alternative
dompdf Alternative with Real Chromium Rendering for PHP and Laravel
dompdf is the default HTML to PDF library in most PHP and Laravel projects, and its ceiling is well known: it implements its own CSS engine, roughly a subset of CSS 2.1, so flexbox, grid, modern web fonts and any JavaScript are out of reach. When your template outgrows that, the honest options are mPDF, Spatie Browsershot on your own headless Chrome, or a rendering API. SitePDF renders your HTML in managed Chromium, so the PDF matches the browser, and keeps a dated copy of it.
- PDF and archive in one call
- Plans from $49 a month
- Your HTML stays yours
Short answer
People search for a dompdf alternative when a layout that looks right in Chrome comes out broken from dompdf. The cause is structural: dompdf parses HTML and CSS in pure PHP with its own engine, which is close to CSS 2.1 and does not support flexbox, CSS grid or JavaScript, and handles web fonts awkwardly. For simple documents dompdf is free and fine, so if your invoice is a basic table you should probably keep it. When you need modern CSS to survive, you have three real choices: move up to mPDF for better CSS inside the same pure PHP family, run Spatie Browsershot to drive a real headless Chrome yourself, or call a rendering API that runs the browser for you. SitePDF is the last option: send HTML or a URL, get a pixel faithful PDF from managed Chromium, with an optional timestamped archive of the source, and no browser to install on your servers.
Written and fact checked by the SitePDF team.
dompdf and the alternatives, compared honestly
dompdf and mPDF are free open source PHP libraries. Browsershot is free but you run the browser. SitePDF figures are from our pricing page.
| dompdf | Browsershot (self-host) | SitePDF | |
|---|---|---|---|
| Rendering engine | Own pure-PHP engine, ~CSS 2.1 | Real headless Chrome | Managed Chromium |
| Flexbox and CSS grid | No | Yes | Yes |
| Web fonts | Fiddly, often wrong | Yes | Yes |
| Runs JavaScript | No | Yes | Yes |
| Matches what Chrome shows | Only for simple CSS | Yes | Yes |
| Infrastructure to run it | None, pure PHP | Node and Chrome on every server | None, it is an API |
| Works on shared hosting | Yes | Usually not | Yes |
| Cost | Free | Free plus your server and ops time | $49/mo for the in-browser converter, API from $49/mo ($24/mo billed yearly) |
| Timestamped record of the source | No | No | Yes. archive=true. |
dompdf is genuinely the right tool for simple, controlled layouts, and it is free. This page is about the case where your template needs modern CSS or JavaScript that dompdf cannot render, which is when people go looking for an alternative in the first place.
Where dompdf is still the right choice
dompdf installs in one Composer command, runs in pure PHP with no system dependencies, and for a straightforward document it just works. A plain invoice, a receipt, a table heavy report, a letter: if the layout is simple and you build it with dompdf in mind, the output is fine and it costs nothing. On shared hosting where you cannot install a browser, that matters even more. Do not replace dompdf because a blog told you to; replace it when it actually fails your template.
The failure is specific and easy to recognize. Your page uses flexbox or CSS grid and the columns collapse into a stack. A web font renders as a fallback. A chart that draws with JavaScript is simply blank, because dompdf has no browser to run the script. Those are not bugs you can configure away; they are the edges of a CSS 2.1 era engine. When you hit them, it is time to move.
mPDF is the upgrade inside the pure PHP family
If dompdf is close but you need better CSS support or non Latin scripts, mPDF is the natural next step and stays inside the pure PHP world, so there is still no browser to install. It handles more CSS, has solid Unicode and right to left support, and is a reasonable pick for multilingual reports and certificates. What it does not do is change categories: mPDF still parses HTML and CSS itself rather than rendering in a browser, so flexbox, grid and JavaScript remain out of reach. If your template was designed for the web and depends on modern layout, mPDF will get you closer than dompdf but not all the way. The comparison of PHP routes further down this page puts each of these libraries against a real browser.
Snappy and wkhtmltopdf are the PHP answer to avoid in 2026
Snappy (knplabs/knp-snappy, or barryvdh/laravel-snappy in Laravel) is a PHP wrapper that shells out to the wkhtmltopdf binary, and it still shows up near the top of results for HTML to PDF in PHP. For years it was the standard way to get browser like output from PHP, because wkhtmltopdf used a real WebKit engine and handled far more CSS than dompdf.
That advice is out of date. The wkhtmltopdf project was archived in January 2023. Its frozen WebKit predates modern CSS, so flexbox and grid render inconsistently, and it carries CVE-2022-35583, a server side request forgery flaw rated 9.8 that nobody will patch. A new PHP PDF pipeline built on Snappy installs an abandoned binary with a critical open vulnerability on your servers. Keep an existing Snappy setup alive if you must while you plan the move, and see the wkhtmltopdf alternative page for the replacements by stack.
Browsershot or an API and when you need the browser
When the PDF has to match a modern browser, both honest options use one. Spatie Browsershot drives a real headless Chrome from PHP, so your flexbox, grid, web fonts and JavaScript all render correctly. The cost is that you now run headless Chrome in production: Node and Chrome installed on every server and container, kept patched, and the operational reality that the browser leaks memory, spikes CPU and crashes under concurrency. On shared hosting it is usually not even possible. We cover that true cost in the library versus API comparison and the wider case in the Puppeteer alternative page.
SitePDF runs that same Chromium for you. From PHP it is one HTTP request: no Node, no Chrome, no memory management, and it works on shared hosting because nothing renders on your box. Add archive=true and it also stores a timestamped snapshot of exactly what was rendered, retrievable later by id, which no PHP library gives you. Note that this is a different situation from Snappy over wkhtmltopdf, another popular dompdf successor, which wraps a binary that was archived in 2023 with an unpatched critical CVE; see the wkhtmltopdf alternative page for why that route is off the table for new work.
How to choose an HTML to PDF route in PHP
The choice is rarely "which PHP library is best" in the abstract. It is whether your template needs a real browser and, if it does, whether you want to run that browser yourself. Browsershot gives you Chromium but needs Node and Chrome on every server that renders, which shared hosting usually will not allow. An API call from Laravel's Http client needs nothing installed and works on any host, at a per render cost.
| Your situation | Use |
|---|---|
| Simple layout you control, no modern CSS or JavaScript | dompdf, or mPDF for better CSS and Unicode |
| Multilingual or right to left documents, still a simple layout | mPDF |
| Flexbox, grid, web fonts or JavaScript, and you run your own servers | Spatie Browsershot (real Chrome, you own the fleet) |
| Same modern template on shared hosting, or no appetite to run a browser | A rendering API |
| You need a dated record of every document, not just the file | An API with archiving |
| A new project currently reaching for Snappy or wkhtmltopdf | Stop, pick Browsershot or an API instead |
For a billing feature where the PDF has to be right every time, the API trade usually wins: no browser to patch, no 3am page when Chrome eats the memory on the invoice server, and with archive=true a timestamped copy of each document for the day someone disputes an invoice. Laravel teams can see the same options applied to Blade views on the Laravel HTML to PDF page.
$response = Http::withToken(config('services.sitepdf.key'))
->asForm()
->post('https://api.sitepdf.com/v1/render', [
'html' => view('invoices.show', ['invoice' => $invoice])->render(),
'format' => 'Letter',
'archive' => true, // keep a timestamped copy of this document
]);
$pdfUrl = $response->json('pdf_url');
This is the documented API call shape. Full request and response walkthrough.
Questions about this job
What is the best way to convert HTML to PDF in PHP?
Why does my dompdf PDF not match how the page looks in the browser?
What is the best dompdf alternative for Laravel?
Is dompdf still worth using in 2026?
Can I switch from dompdf without running my own browser?
Does dompdf keep a record of the PDFs it generates?
Index
More PDF and archiving tools
- Convert HTML to PDF
- Webpage to PDF
- URL to PDF API
- Website archiving
- Monitor website changes
- Screenshot API
- React to PDF
- Java PDF library
- C# PDF library
- Python PDF generation
- HTML to PDF Node.js
- Laravel HTML to PDF
- Vue to PDF
- Next.js PDF generator
- Angular to PDF
- Markdown to PDF API
- Django HTML to PDF
- Blazor HTML to PDF
- Spring Boot HTML to PDF
- Airtable to PDF
- Rails HTML to PDF
- PDF generator API
- Website archiving software
- Document generation API
- Legal document automation software
- Document automation software
- Bulk HTML to PDF
- Accessible PDF generation
- ADA compliance audit cost
- 508 compliance testing
- PDF remediation
- VPAT and ACR
- PDF accessibility checker
- Wayback Machine alternative
- Best HTML to PDF API
- DocRaptor alternative
- Puppeteer alternative
- Wkhtmltopdf alternative
- PDFShift pricing and alternative
- Urlbox pricing and alternative
- PDFCrowd alternative
- Api2Pdf alternative
- Browserless alternative
- APITemplate alternative
- CraftMyPDF alternative
- PDFMonkey alternative
- Gotenberg alternative
- GrabzIt alternative
- Adobe PDF Services API
- PDF SDK pricing
- HTML to image API pricing
- Adobe Document Generation API pricing
- jsreport pricing
- PDFBolt pricing
- PDFEndpoint pricing
- Formstack Documents pricing
- Documint pricing
- iLovePDF API pricing
- Browserless pricing
- PandaDoc API pricing
- CloudConvert API pricing
- Encodian pricing
- IronPDF pricing
- Salesforce document generation pricing
- SelectPdf, HiQPdf and EvoPdf pricing
- CloudConvert alternative
- Direct mail API pricing
- E-signature API pricing
- Sparticuz Chromium Lambda cost
- Browserbase pricing
- Aspose PDF pricing
- PDF API pricing
- How it works
- Features
- Pricing
Get started
Render and archive with one API call
A pixel perfect PDF and a dated copy of the page from the same request. Plans from $49 a month, half price billed yearly.