EnglishPortuguêsEspañol

Jh2pdf — JavaScript HTML 2 PDF

Pixel-perfect HTML to PDF, without a browser on the server. The browser measures the layout; PHP only draws the PDF. No headless Chrome, runs on shared hosting.

Examples gallery →Tables, gradients, shadows, filtered images, lists, hand-drawn marks and an invoice, with the generated PDF. Documentation →Installation, JS and PHP API, supported CSS, fonts, security, performance and dependencies. Minimal example →The smallest possible code: one HTML page and one PHP endpoint.

Why Jh2Pdf?

Install

composer require geisonq/jh2pdf

Then copy js/jh2pdf.js to your site. Source code on GitHub · package on Packagist.