Why Convert HTML to PDF?
HTML is the language of the web, but it is not always the best format for sharing, printing, or archiving content. PDFs preserve exact formatting across every device and operating system, making them ideal for invoices, reports, resumes, documentation, and any content that needs to look the same everywhere. Converting HTML to PDF lets you take advantage of HTML's flexible layout capabilities while producing a universally compatible output.
How the Conversion Works
ConvertKr renders your HTML code in a hidden container that matches the exact pixel dimensions of your selected page size. The container uses system fonts and applies your chosen margin as padding. The tool then uses html2canvas to capture the rendered content as a high-resolution image at 2x scale for sharp text and graphics. If the content exceeds the height of a single page, it is sliced into page-sized chunks. Each chunk is embedded as a JPEG image in a PDF page created with pdf-lib, producing a clean multi-page document.
Tips for Best Results
Use inline CSS styles or embedded style tags for the most reliable rendering. Avoid external stylesheets and JavaScript, as they are not loaded during conversion. Keep images to CORS-accessible URLs or use base64 data URIs. Use standard web fonts (system-ui, Arial, Georgia, monospace) for consistent rendering across devices. For tables and complex layouts, test with the live preview before converting. If your content is very long, the tool will automatically paginate it.
Supported HTML Features
The tool supports all standard HTML elements: headings (h1-h6), paragraphs, lists (ordered and unordered), tables with borders and styling, blockquotes, horizontal rules, images, links (rendered visually but not clickable in PDF), spans with inline styles, divs with flexbox or grid layouts, and any valid CSS properties that the browser's rendering engine supports. You can include a full HTML document with doctype, head, and body tags, or simply paste a fragment.
Privacy and Security
All HTML rendering and PDF generation happens entirely within your web browser. Your code is processed by html2canvas and pdf-lib — both client-side JavaScript libraries. No data is sent to any server at any point. The html2canvas library is loaded from a CDN on first use and cached by your browser. Your HTML code, rendered images, and generated PDF all exist only in your browser's memory and are cleared when you close the tab.