Chuyển đến nội dung

PDF sang HTML

Chuyển PDF thành trang web - văn bản dễ đọc, hoặc ảnh trang.

Xử lý trên thiết bị của bạn

Công cụ này chạy hoàn toàn trong trình duyệt của bạn. Tệp của bạn không bao giờ được tải lên, và bạn có thể tự kiểm chứng điều đó trong tab mạng của trình duyệt. Tự kiểm chứng: mở tab mạng của trình duyệt và theo dõi. Bạn sẽ thấy một yêu cầu nhỏ hỏi xem bạn còn tác vụ nào không - một tên công cụ và một mã băm, không bao giờ là tệp.

Công cụ này làm gì

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.

Cách hoạt động

  1. 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.
  2. Pick the mode: text for a readable page that re-flows, page pictures for something that matches the original exactly.
  3. Leave Complete HTML document and Put the styles inside the file on unless you are pasting the result into a page you already have.
  4. In page pictures mode, set the resolution. 120 dpi is legible on screen; 200 dpi is sharper and roughly three times the bytes.
  5. 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.

Công cụ này không làm được gì

  • 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.

Câu hỏi thường gặp

Hai chế độ khác nhau ở điểm nào?
Chế độ văn bản trích xuất chữ và ghi ra HTML thật - tiêu đề, đoạn văn, danh sách, liên kết - nên trang tự giãn dòng và trình đọc màn hình có thể theo dõi được. Chế độ ảnh trang dựng mỗi trang thành một hình ảnh với văn bản đặt vô hình phía trên, nên kết quả khớp với bản gốc và vẫn tìm kiếm được, nhưng không thích ứng với màn hình. Hãy chọn theo điều nào quan trọng hơn: đọc nó, hay nhận ra nó.
HTML có trông giống PDF của tôi không?
Ở chế độ văn bản thì không, và cố ý như vậy. Phông chữ, các cột và hình học trang bị loại bỏ để nội dung có thể giãn dòng theo mọi độ rộng màn hình. Ở chế độ ảnh trang, kết quả giống hệt PDF về mặt hình ảnh, vì mỗi trang là một ảnh chụp của nó.
Các hình ảnh bên trong tài liệu có được chuyển sang không?
Ở chế độ ảnh trang thì có, vì toàn bộ trang gồm cả tranh minh họa được dựng thành một hình ảnh. Ở chế độ văn bản thì không - bản chuyển đổi chỉ ghi văn bản và cấu trúc.
Kết quả là một tệp hay một thư mục?
Luôn là một tệp. CSS được đưa vào bên trong và mọi ảnh trang được nhúng dưới dạng data URI, nên không có gì bị mất khi tệp được di chuyển hay gửi qua thư. Tắt Tài liệu HTML hoàn chỉnh sẽ cho bạn một đoạn để dán vào một trang sẵn có.
Có gì được tải lên không?
Không. Việc trích xuất văn bản và dựng trang đều chạy trong một Web Worker trong trình duyệt của bạn, nên thiết lập độ phân giải ảnh hưởng đến thời gian máy của bạn làm việc chứ không phải độ dài của một hàng đợi. Hãy theo dõi tab mạng trong lúc chuyển đổi và bạn sẽ thấy không có gì rời đi.

Công cụ liên quan