跳到主要内容

HTML 转 PDF

将 HTML 转换为可下载的 PDF。粘贴 HTML 标记或上传 .html 文件,选择页面大小和字体,并在浏览器中完全转换:无需上传,无需注册,无转换限制。

输入

Drop a file or browse
One file · text

读取为 UTF-8 文本并放入上面的框中。

代码块和内联代码始终以等宽字体呈现。

页面内容周围的空白,以磅为单位(72 pt = 1 英寸)。

输出

Your PDF will appear here to download.
这对您有帮助吗?

使用指南

Turn HTML into a real, shareable PDF — headings, bold/italic text, lists, tables, blockquotes, code blocks and links all render as proper page layout, not a screenshot. Paste HTML markup or upload an .html file, pick a page size and font, and download the result — all in your browser.

How to use it

  1. Paste your HTML into the box, or drop an .html file to load it there.
  2. Open Page options to set the page size, orientation, body font (Helvetica or Times), font size and margin.
  3. Press Convert to PDF, then download document.pdf.

What renders

  • Headings (<h1> through <h6>), each at a distinct size
  • Bold, italic and text formatting, including combinations
  • Bulleted, numbered and nested lists
  • Fenced code (<pre>/<code>) in a monospace font on a shaded background
  • Blockquotes, rendered indented and italic
  • Tables, with column alignment preserved
  • Links (clickable in the PDF) and horizontal rules

A content PDF, not a screenshot

This produces a clean, readable PDF from your HTML's structure — headings, text, lists, tables and links laid out on real pages. It isn't a pixel-perfect visual clone of a styled webpage (custom fonts, background colors, precise CSS positioning and images aren't reproduced); if your goal is an accurate document someone can read, search and print, that's exactly what this gives you, without shipping a screenshot dressed up as a PDF.

Free in your browser, private by default

The PDF is built entirely on your device — your HTML is never uploaded, there's no signup, and no cap on how many files you convert. There's no file-size limit beyond what your browser can hold in memory, and long documents automatically flow across as many pages as they need.

Is there an API?

Yes. The same tool is available as a developer API (POST /v1/tools/html-to-pdf) for converting HTML from a script or backend — handy for turning a generated report or email template into a distributable PDF in CI. Send the HTML as a string; the response carries the PDF as a data URL. The in-browser tool on this page stays free.

I have a live webpage, not HTML source

Use URL to PDF instead — give it a live URL and it fetches the page's readable content server-side and typesets it into a PDF, no HTML source needed.

I need Markdown instead of HTML as my source

Use Markdown to PDF, which lays out Markdown — including GitHub-Flavored tables, strikethrough and task lists — on the exact same page layout engine.

I need HTML from this PDF's source instead of a download

Use HTML to Markdown to get clean Markdown source from the same HTML instead of a PDF.

html to pdfconvert html to pdfwebpage to pdfhtml file to pdfsave html as pdfhtml documentprint html to pdfpdf converter

Use it from code

From 3 credits per call

REST API

curl -X POST https://api.iotools.cloud/v1/tool/html-to-pdf \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "htmlSource": "<h1>Project Report</h1>\n<p>A short summary of th…",
    "pageSize": "a4",
    "orientation": "portrait",
    "font": "helvetica",
    "fontSize": "12",
    "margin": "40"
  }'

Swap in your own key from your account. The tool's fields are the body — no wrapper.

Ask an AI agent

Use the IOTools `html-to-pdf` tool (HTML to PDF) on this input:

YOUR_INPUT_HERE

Paste this at any agent connected to the IOTools MCP server, then add your input.

喜欢这些工具?去掉广告吧。

一次性付款即可永久移除您账户中的所有广告。无需订阅,不追踪。