PDF 转 HTML
把 PDF 转成网页——可读的文字,或整页图片。
这款工具完全在你的浏览器中运行。文件从不上传,你可以在浏览器的网络标签中亲自验证这一点。 亲自验证:打开浏览器的网络标签观察。你会看到一个查询你是否还有剩余任务的小请求,只包含工具名称和一段哈希,绝不会包含文件。
这款工具的作用
There are two ways to turn a PDF into a web page, and they suit different people, so both are here. Text mode writes headings, paragraphs, lists and links as real HTML: it will not look like the PDF, and that is the point, because it re-flows on a phone, it is searchable, and a screen reader can follow it. Page pictures mode renders every page as an image with the extracted text positioned invisibly over it - identical to the PDF, and close to useless on a small screen. Either way the result is one self-contained file.
Use text mode when a document has to be readable on a phone, indexable by a search engine, or usable with a screen reader - a policy, a manual, a report that people keep pinch-zooming. Use page pictures when appearance is the whole point and the file has to look like the original: a form, a certificate, a signed letter being shown rather than read.
工作原理
- Drop the PDF onto this page. In text mode the file is checked for a text layer first, and a scan is refused with a pointer to OCR PDF.
- Pick the mode: text for a readable page that re-flows, page pictures for something that matches the original exactly.
- Leave Complete HTML document and Put the styles inside the file on unless you are pasting the result into a page you already have.
- In page pictures mode, set the resolution. 120 dpi is legible on screen; 200 dpi is sharper and roughly three times the bytes.
- Press Convert to HTML and the single .html file downloads.
The output is one file with its stylesheet inlined, so it opens from a folder or an email attachment without the missing-stylesheet page that a linked CSS file produces. It is also written to stay readable with CSS switched off entirely. That is partly an accessibility property and partly a proof of what is underneath: markup that means something, rather than a heap of absolutely-positioned spans arranged to look right.
Text mode reads the page in one column. Multi-column layouts, sidebars and text boxes are flattened into a single reading order, which is the trade you are making in return for a page that works at 360 pixels wide.
In page pictures mode the images are embedded as data URIs rather than written as a folder of files next to the HTML. Base64 costs about 33 per cent over the raw bytes, which is worth paying for a file that can be mailed as one attachment. It does mean a long document at 200 dpi becomes heavy, so start at the default and raise it only if the result looks soft.
Rendering and text extraction both happen in your browser through PDF.js. Nothing about the document is transmitted, including in page pictures mode, where the images are produced on your own device rather than by a rendering server somewhere.
这款工具做不到的事
- Text mode does not preserve the layout. Columns collapse into one, absolute positioning is dropped, and the page reads top to bottom.
- Page pictures mode embeds every page as base64 inside the file, which adds about a third to the size of the images and makes a long document slow to open.
常见问题
- 两种模式有什么区别?
- 文字模式提取文字并写成真正的 HTML——标题、段落、列表、链接——所以页面会重排,屏幕阅读器也能读下去。整页图片模式把每页渲染成图片,再把文字隐形地叠在上面,因此结果与原稿一致且仍可搜索,但不会随屏幕自适应。看你更看重哪一点:读它,还是认出它。
- 生成的 HTML 会和我的 PDF 一样吗?
- 在文字模式下不会,而且是刻意如此。字体、分栏和页面尺寸都会被舍弃,好让内容能重排到任何屏幕宽度。在整页图片模式下,结果与 PDF 在视觉上完全相同,因为每一页都是它的一张图片。
- 文档里的图片会带过来吗?
- 在整页图片模式下会,因为包含插图在内的整页都被渲染成一张图片。在文字模式下不会——这个转换只写出文字和结构。
- 结果是一个文件还是一个文件夹?
- 始终是一个文件。CSS 内嵌其中,任何整页图片都以 data URI 嵌入,所以移动或邮寄这个文件时不会丢东西。关掉“完整 HTML 文档”就得到一段片段,可粘贴进你已有的页面。
- 会有内容被上传吗?
- 不会。文字提取和页面渲染都在你浏览器的 Web Worker 里进行,所以分辨率设置影响的是你自己机器工作多久,而不是排队多长。转换过程中看着网络标签,你会看到什么都没有发出去。