ShreePrati logoShreePrati
PDFDeveloperFile

HTML to PDF

Paste or upload HTML and render it into a real, paginated A4 PDF in your browser. Scripts and embeds are stripped before rendering for safety.

Paste your HTML

Page orientation

How to convert HTML to PDF

Paste your HTML markup or upload an .html file, then render it into a paginated A4 PDF you can download.

Safe rendering

Scripts, iframes and other active embeds are stripped before rendering, so only the static markup and styles are converted.

Convert HTML step by step

  1. Paste markup into the editor, or press Upload .html to load an .html or .htm file of up to 2 MB. Press Load sample to try a small invoice table first.
  2. Choose Portrait or Landscape. Landscape gives the content a wider canvas, which suits wide tables.
  3. Press Convert to PDF. The markup is laid out off-screen, captured and split into A4 pages.
  4. Download the result, which is saved as document.pdf. Press Convert more HTML to start again.

How the page is laid out

Your HTML is placed in a white box about 794 pixels wide in portrait or 1,123 pixels wide in landscape, with 32 pixels of padding. Unless your own CSS says otherwise, text uses Arial at 14 px with a line height of 1.5 on a white background. Elements wider than the box, such as fixed-width tables or large images, may be cut off at the right edge, so use percentage widths or max-width: 100% where you can.

The rendered content is captured as a high-resolution image at twice the screen resolution and placed on A4 pages. When the content is taller than one page, it is sliced into page-height pieces and continued on the next page.

What to expect in the PDF

  • The pages are images, so text cannot be selected, searched or copied, and links are not clickable.
  • Page breaks fall at fixed heights, so a line of text or a table row can be split between two pages. CSS page-break rules are not used.
  • Styles in a style element or style attributes are applied. Linked stylesheets and web fonts may not load.
  • Images from other websites only appear if that server allows cross-origin access. Embedding images as data URLs is the most reliable option.
  • Because the browser draws the text, any language your device has fonts for renders correctly.

Good uses for this tool

It works well for turning simple, self-contained HTML into a document you can share or print: invoices and receipts built from a template, email newsletters, exported reports, HTML tables, short notes or a styled letter. For long documents where readers need to search or copy text, a word processor's own PDF export or your browser's Print to PDF option produces a text-based file instead.

Troubleshooting

  • Something is missing: interactive content built with JavaScript does not appear, because scripts are removed. Paste the final rendered HTML instead.
  • Content is cut off on the right: switch to Landscape or make wide elements responsive.
  • Images are blank: download them and embed them as data URLs, or host them on a server that allows cross-origin requests.
  • Very long input: only the first 500,000 characters are converted, and very long pages take longer to render.

Frequently Asked Questions

Inline styles and publicly reachable images render. Some external resources may be blocked by the browser.

Related Tools