How to use the HTML to PDF Converter
- 1. Add your HTMLPaste code or choose an .html file; the preview shows it at the PDF's width.
- 2. Set the pageChoose page size, orientation, margins and quality.
- 3. ConvertDownload the PDF and check the page count and size.
How the conversion works
Your HTML is first cleaned: scripts, frames, external links and event handlers are removed, and the page is shown in a locked-down frame where nothing can run or load from the internet. The page is then drawn to a high-resolution image with the html2canvas library and placed onto PDF pages with jsPDF. Page breaks are moved up to the nearest blank row so lines of text aren't cut in half, and CSS break-before: page or page-break-before: always starts a new page where you want one. Everything runs in your browser; nothing you type or choose is uploaded.
Because the pages are images, text in the PDF can't be selected or searched. When you need selectable text, open the HTML file in your browser and use Print, then Save as PDF.
Worked example
The sample is a fee receipt: course fee ₹25,000, study material ₹2,000 and 18% GST of ₹4,860, for a total of ₹31,860, followed by a course schedule that starts with break-before: page. Converted at A4 portrait with 10 mm margins, it gives a 2-page PDF: the receipt on page 1 and the schedule on page 2. The content is 718 px wide, which is 190 mm.
Limits to know
- Put CSS in a
<style>tag; linked stylesheets and web fonts aren't loaded. - Images must be inside the HTML as data URLs, unless you allow loading from https addresses; some sites block that.
- Very long pages (over about 80 A4 pages) should be split into smaller files.
Frequently asked questions
Is my document uploaded?
No. The conversion happens entirely in your browser; only the two libraries are downloaded.
Why doesn't JavaScript on my page run?
Scripts are switched off for safety. Content that only appears after scripts run won't be in the PDF.
Is the HTML to PDF converter free?
Yes. You can open the HTML to PDF converter and fill in every option without signing up. When you convert to PDF for the first time, we ask once for your name and WhatsApp number; after that it, and every other Uncodemy tool, opens straight away.