What this PDF to HTML converter does
HTML is the standard markup language for pages shown in a web browser. [2] This PDF to HTML converter reads the text of your PDF and writes it as an HTML page you can open in any browser, paste into a content system or edit in a text editor.
A PDF describes where every letter sits on a page. [1] It does not say what is a paragraph or a heading. The tool reads the text with PDF.js, [3] puts the pieces of each line back in reading order, joins the lines of a paragraph and starts a new paragraph where the gap between lines grows. That is our own working, so complex pages can come out differently from what you expect.
How to convert a PDF to HTML
- Choose a PDF with real, selectable text.
- Leave “Add a heading for each page” ticked if you want page markers, or untick it for one continuous page.
- Press Convert to HTML.
- Download the .html file and open it in a browser to check it.
What the HTML looks like
The file is a complete HTML document with a title taken from the file name. When page headings are on, each page starts with an h2 heading such as “Page 1”, followed by one p element for each paragraph. The markup is small and plain on purpose, so you can style it with your own CSS.
| HTML | |
|---|---|
| Page break | A new h2 heading (optional) |
| Paragraph | A p element |
| Text characters | Escaped so symbols such as < and & are safe |
| Pictures and tables | Not included |
| Fonts and colours | Not included |
What is not carried over
- Page layout and columns. Text from two columns is read line by line, so columns can mix.
- Tables. Table cells become ordinary text lines.
- Pictures, logos and drawings.
- Fonts, sizes, bold and italic.
- Links and bookmarks.
- Text inside scanned pictures. A scanned PDF has none, so use the OCR PDF tool first.
Good uses
- Moving the wording of a report, policy or manual into a website editor.
- Making a lightweight version of a document that loads fast on a phone.
- Giving a screen reader a simpler version of the wording.
- Searching the text with your own tools.
For layout-faithful pages, the PDF stays the better format. HTML is best when you want the words and are happy to design the page again.
Tips
- Try a small PDF first to see how paragraphs are detected.
- If paragraphs are broken in odd places, the PDF probably adds a blank line for every text line. Edit the result in a text editor.
- Only the first 500 pages are read. A note appears when a PDF is longer.
- Check any special characters, especially in languages with accents.
A worked example
Suppose a PDF has two pages. Page 1 has a title line and two paragraphs. Page 2 has one paragraph that continues from page 1. With page headings on, the HTML shows “Page 1”, then the three text blocks as separate p elements, then “Page 2” and its paragraph. With headings off, the same text appears as one run of paragraphs with no page markers, which is better for a web page where page breaks mean nothing.
You can paste the p elements straight into a content editor. If you need titles and subheadings, add h2 and h3 tags by hand, because a PDF does not say which lines are headings. That judgement is easy for a person and unreliable for a program.
How paragraphs are detected
For each page, the tool takes the pieces of text with their positions. It sorts them from top to bottom and left to right and groups pieces on about the same height into a line. It then looks at the usual gap between lines. A gap well above the usual one starts a new paragraph. A line ending in a hyphen is joined to the next line when the next one starts in lowercase, so “inter-” and “national” become “international”. These rules are our own working and give good results on plain, one-column text.
Common mistakes
- Expecting a copy of the layout. For that, a PDF viewer is the right tool.
- Converting a scan. If the PDF is a picture of pages, run OCR first.
- Converting a two-column paper and expecting neat columns. The lines of both columns are read across, which can mix them.
- Forgetting to add styling. The file has no CSS, so it looks plain in a browser. That is by design.
- Publishing text you do not own. Converting a file does not change who holds the rights.
After you convert
- Open the .html file in a browser to check it reads well.
- Open it in a text editor to add headings, links and styling.
- Use a validator or your content system’s preview before you publish.
- Check special characters such as quotes and dashes.
For editable office documents rather than web pages, the PDF to Word Converter makes a .docx file from the same kind of text.
Privacy
PDF.js runs in your browser tab and reads the file there. [3] Nothing is sent to a server, and the HTML file is built on your device.
What next
Use this often? Add PDF to HTML to your Home screen.
Frequently asked questions
How do I convert a PDF to HTML?
Choose the PDF, press Convert to HTML and download the .html file. The tool writes the text as paragraphs, with an optional heading for each page.
Does the PDF to HTML converter keep the layout?
No. It copies the text only. Columns, tables, pictures, fonts and colours are not carried over.
Why does the converter say no text was found?
The PDF is probably a scan, which holds only pictures of pages. Run the OCR PDF tool first to add a text layer, then convert.
Is the HTML clean enough to edit?
Yes. It is plain HTML with h2 headings and p paragraphs and no styling, so you can edit it in any text editor.
Is my PDF uploaded?
No. The file is read and the page is built in your browser.
Was this tool helpful?
What went wrong?
We only receive the reason you pick, never what you typed into the tool.
Thanks for your feedback.