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.

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

Use a PHP PDF library when your HTML uses a supported, document-oriented CSS subset. Use Chromium when you need modern CSS, JavaScript execution, or close visual parity with a web page. The reliable workflow is to generate deterministic HTML, configure fonts and resources, render with the chosen engine, save or stream the PDF, and inspect representative output before shipping. No renderer is universally best; the template and deployment environment decide the trade-off.

Choose the rendering architecture first

HTML-to-PDF in PHP normally follows one of three architectures:

  • PHP-native rendering: a Composer package parses HTML and CSS inside the PHP process. Deployment is simpler, but CSS support is a documented subset rather than a complete browser.
  • Browser-backed rendering: PHP invokes Chromium directly or through a wrapper. You gain current browser layout, JavaScript and web-font behavior, at the cost of a browser runtime that must be installed, patched and monitored.
  • Separate rendering service: PHP sends HTML or a URL to a service such as Gotenberg. This keeps browser processes out of the web worker, but adds network, service-availability and version-management concerns.

Browser output can change after a Chromium update; PHP libraries can change when their parser or supported CSS subset changes. Pin versions, retain sample documents, and compare generated PDFs during upgrades. The TCPDF comparison page documents package metadata and capabilities checked on 31 August 2026; project requirements can change, so verify the current release documentation before deployment (TCPDF comparison).

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

Compare the main PHP options

Approach Best fit Important constraints
Dompdf Simple invoices, reports and tables where a PHP-only deployment is useful. Mostly CSS 2.1; no flexbox or CSS Grid. Table rows must fit on one page. Remote files need explicit access configuration, and one Dompdf instance should not be reused for multiple documents (Dompdf documentation).
mPDF UTF-8 documents needing headers, footers, page numbers, tables of contents, barcodes or print-oriented color features. Its manual recommends headless Chrome for state-of-the-art CSS or mirroring existing pages (mPDF manual).
tc-lib-pdf Pure-PHP projects that can target its documented HTML/CSS subset. The current project states PHP 8.2 or later is required. Validate page flow against your actual templates (project site).
Browsershot/Chromium Modern CSS, JavaScript, responsive layouts and close correspondence to a website. PHP invokes Node, Puppeteer and Chromium; all must be installed, secured and maintained.
Gotenberg PHP Teams that want Chromium and LibreOffice behind a separate HTTP service. You operate or obtain the service and must handle network failures and renderer updates.
Snappy/wkhtmltopdf Existing systems whose templates are already verified against its output. wkhtmltopdf’s upstream was archived in January 2023 and its Qt WebKit engine predates much of CSS3; it is a legacy choice for new work (comparison).

For a new project, start with Dompdf or mPDF only if your template fits their documented subset. Choose Chromium when fidelity to a modern site matters more than keeping rendering inside PHP.

#1 Best Overall
Epson EcoTank ET-2800 Wireless Color All-in-One Supertank Printer - Black
  • 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

A complete Dompdf workflow

The following example shows the shape of a PHP-native implementation. Check the installed package’s current README and release requirements before copying it; Dompdf notes that its README can describe the latest stable code rather than the exact release you installed.

1. Install and prepare an isolated renderer

composer require dompdf/dompdf

Keep templates separate from request data, escape user-controlled values, and use a dedicated renderer instance for each document. Set a predictable paper size and orientation. Restrict filesystem access with a configured chroot rather than granting the process access to the whole server.

2. Render and stream a PDF

<?php
require __DIR__ . '/vendor/autoload.php';

use DompdfDompdf;
use DompdfOptions;

$options = new Options();
$options->set('isRemoteEnabled', false);
$options->setChroot(__DIR__ . '/public');

$html = file_get_contents(__DIR__ . '/templates/invoice.html');
$dompdf = new Dompdf($options);
$dompdf->loadHtml($html, 'UTF-8');
$dompdf->setPaper('A4', 'portrait');
$dompdf->render();
$dompdf->stream('invoice.pdf', ['Attachment' => true]);

For a stored file, use the renderer’s output method and write the bytes to a directory outside the web root. For an inline response, send a PDF content type and a safe, application-generated filename. Do not mix HTML, warnings or debug output into the response body; even one stray character can corrupt a PDF download.

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

3. Handle images, styles and remote resources deliberately

Local images and stylesheets must be inside the configured chroot. Remote resources require isRemoteEnabled and either cURL or PHP’s allow_url_fopen support. Enabling unrestricted remote access can let a template fetch internal addresses, so prefer downloaded, validated assets or a tightly controlled host allowlist. Make image URLs absolute when the renderer cannot resolve relative paths.

Rank #2
Sale
Epson EcoTank Photo ET-8550 Wireless Wide-Format All-in-One Tank Printer
  • 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⁴

4. Avoid unsupported layout assumptions

Dompdf does not support CSS flexbox or Grid, and its documentation says table rows must fit on one page. Use block flow, floats only where supported, and deliberate page-break rules. Split very large tables into logical sections instead of relying on a row to break across pages. A document that looks correct in Chrome can therefore require a PDF-specific stylesheet.

mPDF for document-oriented output

mPDF accepts UTF-8 HTML and provides features commonly needed in reports and print workflows. A minimal integration follows the same lifecycle—construct, configure, write HTML, then output—but use the method names from the version installed through Composer and its manual (mPDF documentation). Configure font directories and fallback fonts for every language you generate, and define headers, footers, page numbering and margins in the library’s document settings rather than relying only on browser CSS.

mPDF’s own guidance is explicit: “If you are looking for state of the art CSS support, mirroring existing HTML pages, use headless Chrome.” Treat that as a decision boundary, not a promise that mPDF will reproduce a responsive website.

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

When Chromium is the right renderer

Use Chromium for flexbox, Grid, advanced print CSS, JavaScript-generated content, web components or pages whose visual identity must match the browser. A PHP wrapper such as Browsershot still depends on Node, Puppeteer and a compatible Chromium binary. A separate service such as Gotenberg moves those dependencies to another process or host.

Rank #3
HP Smart Tank 5000 Wireless All-in-One Ink Tank Printer, Scanner, Copier with 2 Years of Ink Included, Best-for-Home, Cartridge-Free, Refillable and AI-Enabled. (5D1B6A)
  • 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.

Operational checklist

  • Pin Node, Puppeteer and Chromium versions together.
  • Run the browser with a restricted user and temporary profile directory.
  • Set navigation and rendering timeouts; do not let a request hold a PHP worker indefinitely.
  • Wait for the application-specific readiness signal, not merely the first HTML response, when JavaScript populates the page.
  • Block access to private network ranges if arbitrary URLs can be submitted.
  • Record renderer version, input identifier and failure reason for every job.

For high volume, queue jobs and return a job identifier instead of keeping an HTTP request open. A service architecture adds a network hop but lets you scale browser workers independently from PHP.

Make templates PDF-safe

Fonts and character sets

Declare UTF-8, install the required font files on the rendering host, and configure fallback fonts. Test accents, emoji, right-to-left scripts and CJK text separately; missing glyphs can appear as empty boxes even when Latin text works.

Images and external assets

Use deterministic asset URLs, verify MIME types, and set dimensions to prevent layout shifts. Inline small critical SVG or raster assets when the renderer’s URL policy makes external loading unreliable. Do not let untrusted HTML reference arbitrary URLs.

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

Pagination

Define page size, margins and print colors. Add explicit breaks before major sections, keep headings with their following content where supported, and test long paragraphs, invoices with many rows, landscape pages and an empty-data case. Browser and PHP engines can make different break decisions.

Rank #4
NDYIN Portable Printers Wireless for Travel, N80 Bluetooth Thermal Printer
  • 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

Security

Escape values inserted into HTML, sanitize any user-authored markup, disable unnecessary scripts, and isolate temporary files. Remote-resource support and browser navigation are SSRF risks when URLs are user controlled.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Testing and reliability before production

  1. Create a fixture set containing short and long text, tables spanning several pages, images, custom fonts, non-Latin characters, headers, footers and intentional page breaks.
  2. Render each fixture in a clean environment and inspect page count, text extraction, image presence and visual output.
  3. Repeat renders to detect nondeterministic timestamps, remote assets or JavaScript.
  4. Run the fixtures after every package, PHP, browser or operating-system upgrade.
  5. Keep the original HTML and renderer version alongside failed output so defects can be reproduced.

Do not treat a successful HTTP response as proof of a correct document. A PDF can be syntactically valid while missing a font, clipping a table or silently omitting an image.

Troubleshooting common failures

Symptom Likely cause Fix
Flexbox or Grid collapses PHP-native renderer does not implement those layout systems. Rewrite the PDF stylesheet with supported blocks/tables or move the document to Chromium.
Images are blank URL access is disabled, the file is outside chroot, or the URL is relative. Use approved local paths, configure remote access with cURL where necessary, and make URLs resolvable.
Rows overlap or disappear A table row cannot fit the page in Dompdf. Split content into smaller rows/sections or use a renderer with suitable pagination.
Characters show as boxes Font lacks glyphs or was not installed/configured. Install and register a font with the needed coverage, then test UTF-8 input.
Browser jobs time out JavaScript, network requests or resource loads never become idle. Set a finite timeout, wait for a specific selector, remove unnecessary third-party requests and capture diagnostics.
PDF download is corrupt PHP notices, whitespace or debug output preceded the PDF bytes. Disable display errors for the endpoint, buffer carefully, and return only PDF bytes and headers.
Second Dompdf document is wrong A renderer instance was reused and retained state. Create a fresh Dompdf instance for every HTML document.

Or skip the browser setup

If your goal is a screenshot or PDF of a URL rather than rendering a PHP template inside your application, ScreenshotNeo provides a website screenshot API and MCP server. One GET request returns PNG, JPEG, WebP or PDF. It accepts cookie/consent banners before capture and removes more than 60 known consent platforms, newsletter popups and chat widgets; each cleanup step can be disabled. Bot checks, blank pages, timeouts, failed loads and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP tools—take_screenshot, get_page_info and capture_pdf—work with Claude, Cursor and other MCP clients.

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

cURL

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

Python

import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
r.raise_for_status()
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}`);
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const fs = await import('node:fs/promises');
await fs.writeFile('shot.webp', Buffer.from(await res.arrayBuffer()));

See the ScreenshotNeo documentation for PDF options, full-page capture, selectors, custom CSS and JavaScript, waiting rules, headers, cookies, geolocation, caching, signed links, asynchronous webhooks, bulk capture and the usage API. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000, and every feature is available on every plan. Create a free ScreenshotNeo account.

FAQ

Can PHP render any HTML page as a PDF?

No. PHP-native libraries implement subsets of HTML and CSS. A browser engine is the safer choice for modern layouts, but it introduces runtime and operational dependencies.

Should I use wkhtmltopdf for a new project?

Usually not. Its upstream was archived in January 2023 and its Qt WebKit engine is old. Keep it only when an existing system depends on verified output.

How do I choose between a local browser and a rendering service?

Use a local browser when latency and deployment control favor colocating the renderer. Use a service when isolating browser operations and independently scaling workers is more important.

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

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.