All Over Tools logo
Tool Combiner
Analyze Tools Clean Tools Compare Tools Convert Tools Data Validation Extract Tools Format Tools Generate Tools Organize Tools Transform Tools
Audio Tools Font Tools Image Tools Subtitle Tools Video Tools
Archive Tools Document Tools Ebook Tools File Management Tools PDF Tools Presentation Tools
Config Tools Database Tools Dataset Tools JSON Tools Parser Tools Spreadsheet Tools XML Tools
Business Calculators Construction Calculators Date And Time Calculators Education Calculators Financial Calculators Food Calculators Health Calculators Math Calculators Science Calculators Sports Calculators Statistics Calculators
Blog About Us Contact Us

HTML to PDF Converter

Render HTML code or a web page URL in your browser and convert it to PDF. Choose the paper size, margins and orientation, add header and footer text, apply optional Print CSS, and preview page breaks before downloading.

How to convert HTML to PDF

Start with HTML Code when the markup is already in hand. For a page address, switch to URL and enter it in Web page URL. After the source loads, set Paper size, Orientation, and Margins, then add Header text (optional), Footer text (optional, use {page} and {pages}), or Print CSS (optional, applied on top of the page's own styles) before you click Convert.

Convert HTML code or a web page URL

  1. Paste a full document or snippet into HTML Code. For a page address, switch to URL and enter it in Web page URL.
  2. Let URL fetching finish. The page must allow cross-origin browser requests.
  3. Choose Paper size, Orientation, and Margins. Add Header text (optional), Footer text (optional, use {page} and {pages}), or Print CSS (optional, applied on top of the page's own styles).
  4. Click Convert, inspect the page-break preview, and click Download PDF when the PDF is ready.

What Paper size and Margins change

The Paper size menu lists Letter, A4, and Legal. Orientation switches between Portrait and Landscape. The Margins menu lists Normal, Narrow, Wide, and None. These choices set the render width, page height, and space around the captured content.

HTML Code: <h1>Hello</h1>
Output: html-to-pdf.pdf

How Print CSS and Footer text work

Print CSS is appended after the source styles, so it can override them before capture. Header text and Footer text are written on each PDF page. In Footer text, {page} becomes the page number and {pages} becomes the total number of pages.

Footer text: Page {page}
PDF footer: Page 1

What HTML to PDF conversion preserves

The renderer takes style and stylesheet links from the HTML head, places the body content in a render root, and captures it with html2canvas before jsPDF writes the PDF. The page-break preview estimates pagination. External images, fonts, stylesheets, complex CSS, malformed markup, and script-generated content can change the captured result.

HTML entered in HTML Code is parsed and converted in the browser. That path does not call fetch, XMLHttpRequest, or sendBeacon, and it does not submit a form with the HTML. The URL path calls fetch with credentials omitted, then captures the fetched page. A page that needs login may not retain its session or authenticated content.

Where this comes up

For an invoice, paste the template into HTML Code, add a heading in Header text (optional), and put page numbering in Footer text (optional, use {page} and {pages}).

For a layout check, put print-only rules in Print CSS (optional, applied on top of the page's own styles), then inspect the page-break preview before downloading.

If Web page URL cannot be fetched because the site blocks CORS, paste its static HTML into HTML Code instead.

When another PDF converter fits better

Choose Markdown to PDF Converter for Markdown with themes, a table of contents, or syntax-highlighted code blocks. Choose JPG to PDF Converter for JPG or JPEG images. Choose Word to PDF Converter for DOCX files, or open PDF Convert Tools for the other source formats.

Frequently asked questions

How do I convert a web page URL to PDF?

Switch to URL and enter a complete address in Web page URL. When fetching finishes, choose the PDF settings and click Convert. The page must allow cross-origin access from the browser.

Why did my HTML to PDF conversion fail?

A URL fetch can fail when the target blocks cross-origin requests. Paste static markup into HTML Code instead. For other failures, check the displayed conversion error for unavailable PDF libraries or invalid input.

Can I add page numbers to an HTML PDF?

Yes. Enter text such as Page {page} of {pages} in Footer text (optional, use {page} and {pages}). The converter replaces both placeholders for each generated page.

Does the PDF keep the exact web page layout?

No exact match is guaranteed. The result is a canvas capture placed onto fixed PDF pages, so external resources, CSS, fonts, and long content can affect the layout.

Related Tools

47 views