HTML to PDF

Build a PDF from pasted HTML or a .html file. PHP processing with Dompdf; handy for simple resumes and receipts.

Paste a fragment or full document. Simple CSS usually works; advanced features may be ignored by Dompdf. Max ~600 KB.

Overview

PDF was invented by John Warnock, co-founder of Adobe, in 1991. Warnock wrote an internal memo called The Camelot Project describing a fundamental problem: documents created on a Mac looked different when printed on an HP laser printer or displayed on a Windows PC. The solution was a portable format that would encapsulate fonts, layouts, and graphics so the final document would always look identical — regardless of system, screen, or printer. PDF 1.0 reached the public in 1993 bundled with Adobe Acrobat, and it was expensive. Adoption exploded after Adobe made the Reader free, and in 2008 it opened the format as ISO standard 32000. Today PDF is by far the most widely used format for exchanging formal documents worldwide.

Converting HTML to PDF sounds simple but is technically challenging. HTML was designed to be rendered in windows that users resize, with responsive CSS, infinite scroll, and dynamic JavaScript. PDF, by contrast, exists as fixed pages with absolute dimensions. Most conversion engines handle this in one of two ways: actual rendering — headless Chrome (Puppeteer) or WebKit (wkhtmltopdf), which simulate a full browser and photograph the result — or direct parsing, as Dompdf does, interpreting HTML and CSS without rendering pixels and generating the PDF as vectors. Dompdf runs 100% in PHP without needing browser binaries; the drawback is that support for advanced CSS3, flexbox, and grid is incomplete. For simple resumes, invoices, and letters with basic formatting, it works very well.

This tool uses exactly that: Dompdf running on the server. You paste your HTML, the server generates the PDF and returns the file — no content is stored. Font support is the most sensitive point: use the embedded fonts (DejaVu works well), avoid external Google Fonts (external requests are blocked for security), and if you need special characters from languages like Arabic or Chinese, you will need to embed TTF fonts manually via Dompdf configuration. For more complex layouts with JavaScript or modern CSS, alternatives include commercial APIs such as WeasyPrint, Prince XML, or Chromium-based services.

Technical deep dive

Common questions summarized

  • What is this tool for?: It runs fully in your browser: useful to validate, format, or convert data in everyday development.
  • Are my inputs sent to a server?: Processing happens locally with JavaScript. We do not store what you paste into the text areas.
  • Can I use this for real production data?: Use at your own risk. For secrets (passwords, tokens), prefer controlled environments and your company policies. And always review the generated contents. Never trust blindly things you see on the internet.

Sample payload to try

  • See also the larger "Code Snippets" sample; paste this excerpt to try locally: Sample — <h1>Recibo</h1><p>Item: serviço X, total R$ 100,00</p>

Code Snippets

Code example
<h1>Recibo</h1><p>Item: serviço X, total R$ 100,00</p>

Sample

<h1>Recibo</h1><p>Item: serviço X, total R$ 100,00</p>

FAQ

What is this tool for?

It runs fully in your browser: useful to validate, format, or convert data in everyday development.

Are my inputs sent to a server?

Processing happens locally with JavaScript. We do not store what you paste into the text areas.

Can I use this for real production data?

Use at your own risk. For secrets (passwords, tokens), prefer controlled environments and your company policies. And always review the generated contents. Never trust blindly things you see on the internet.