Skip to the content

Contact usFree tools · No signup · Files stay on your device

PDF Tools

PDF to HTML: the complete guide to turning a PDF into a web page

PDF to HTML: the complete guide to turning a PDF into a web page

Sometimes the content you need is locked in a PDF but you want it on a web page: a notice for a school website, a policy for a help centre, a price list for a CMS. The free PDF to HTML tool reads the text of a PDF and rebuilds it as clean, readable HTML with paragraphs, headings, lists and tables. It runs in your browser, so the PDF is not uploaded.

This guide explains every setting, how the structure is worked out, what is left out, and what to do when the result needs tidying. If you want the other direction, see the HTML to PDF guide.

What PDF to HTML does

A PDF knows where every piece of text sits on a page, but not what it means. The tool reads the text with its position and size, groups it into lines, and then works out structure:

  • Paragraphs: a new one starts after a bigger gap, a change of text size, an indented first line, or a short line that ends in a full stop or similar mark.
  • Headings: lines clearly larger than the body text.
  • Bold and italic, from the fonts used.
  • Bullet and numbered lists.
  • Simple tables, from text that lines up in columns.

It does not keep fonts, colours, columns, pictures, exact positions or hyperlinks. A link in a PDF will appear as plain text, and no <a> tags are made. It works only on PDFs with a real text layer. For scans, see the section on problems below, or use PDF to Text, which can read scanned pages itself.

How to use PDF to HTML, step by step

  1. Open PDF to HTML.
  2. Press Choose a PDF file, or drop a PDF on the box. If it asks for a password, type it; it is used only in your browser.
  3. Press Convert to HTML. A line such as "Reading page 3 of 12…" shows the progress.
  4. When the options appear, choose the Output, Styles and PDF pages settings, and tick or untick the three boxes.
  5. Check the Result. Switch Show between HTML code and Preview.
  6. Press Copy, or Download .html. The download is named after the PDF, for example notice.html, with the prefix "Tech Solution Point - " that every download from this site carries.

The PDF is read once. After that, every option updates the result at once, without reading the file again. The button changes to Convert again, which re-reads the PDF if you want to start over.

Every option explained

Output

Full page (<html>, <head>, <body>) gives a complete document: doctype, a <meta charset="utf-8">, a viewport tag, a <title> and the content. The title is the PDF's file name without .pdf. The language is set from the text: <html lang="bn"> when most of the letters are Bangla, otherwise <html lang="en">. Only these two are told apart, so for a document in another language change the attribute by hand.

Body content only gives just the elements, ready to paste into a CMS or an existing template.

Styles

Minimal (a small style sheet) adds a short <style> block in the head of a full page so that tables, headings and spacing read well when you open the file. None (plain tags only) leaves it out. This setting only affects the full page output; in Body content only there is no style sheet either way. Your own site's CSS then decides how it looks.

PDF pages

Controls how the end of each PDF page shows in the HTML:

  • Run on (no page marks): the pages flow into one continuous document.
  • Horizontal line between pages: adds <hr class="page-break"> between pages.
  • One <section> per page: wraps each page's content in <section class="page" data-page="1">, and the number is the PDF page number.

Pages with no text produce no section, but the numbers still follow the PDF: if page 2 is blank, the sections read data-page="1" and data-page="3". A page that holds only the end of a paragraph from the page before (see below) has no section either.

Turn bullet and numbered paragraphs into lists

On by default. A paragraph that starts with a bullet glyph (•, ●, ▪, ◦, ‣ or ∙) becomes list items, and one that starts with a number such as 1. or 2) followed by a letter becomes a numbered item. Bulleted and numbered items come out as <ul> and <ol>. Untick this if numbered paragraphs, such as clause numbers in a contract, should stay as ordinary paragraphs.

Join a paragraph that continues on the next PDF page

On by default. When a paragraph is cut by a page edge, the two halves are joined into one <p> if it is safe to say they belong together: both are ordinary paragraphs (not headings, lists or tables), the first half does not end like a finished sentence (a full stop, a question mark, a colon or a danda), and the second does not start like a new one (a capital letter, a number or a bullet). A word split with a hyphen at the page edge is put back together. Bangla has no capital letters, so there the first half must also be a full line. Untick it to keep one <p> per PDF page.

Use the first table row as the header

On by default. The first row of each detected table is written as <thead> with <th> cells and the rest as <tbody>. Untick it if the first row is data.

Reading the result

Four figures sit under the options: Paragraphs, Headings, Tables and PDF pages. They help you see whether the structure was found. A document with 0 headings means the PDF used one text size for everything.

The Result panel has two views. HTML code shows the markup, and Preview shows how it renders in a sandboxed frame with scripts turned off. The preview notes that links do not open there.

The code view shows the first 200,000 characters of a very long result, with a note. Copy and Download .html always give the whole thing.

What it accepts and its limits

  • Files: PDFs only. The file picker refuses files over 200 MB, and a file that is not a PDF is refused.
  • Passwords: a PDF with an open password asks for it first. The file bar then says "unlocked with password".
  • Pages: the tool reads every page, then judges heading sizes against the text size of the whole document. There is no page limit, but large files take longer and use more memory.
  • Scans: a PDF with no text layer at all gives "This PDF has no text layer: it is probably a scan or photos of pages. HTML needs real text, so run it through OCR first." with a link to OCR Studio. If only some pages are scans, a warning says how many pages are missing.
  • Pictures: none are exported.

Privacy

PDF to HTML runs in your browser. The PDF is read with pdf.js on your device and the HTML is built there. Nothing is uploaded. The converted text is escaped before it is shown or saved, so nothing in a PDF can run as script when you preview it.

A worked example

Suppose a school notice has a large title "Notice", a paragraph about admissions, a bulleted list of documents and a small fee table. With Body content only, Minimal and Run on, you would get markup in this shape:

<h1>Notice</h1>
<p>Admission for Class 6 opens on 1 January.</p>
<ul>
  <li>Birth certificate</li>
  <li>Two photos</li>
</ul>
<table>
  <thead>
    <tr><th>Class</th><th>Fee (Tk)</th></tr>
  </thead>
  <tbody>
    <tr><td>Six</td><td>1,200</td></tr>
  </tbody>
</table>

The exact result depends on how the PDF was made, so check the Paragraphs, Headings and Tables figures. Switch to Full page before saving a file that you will open in a browser, and check the language in the <html> tag if the text is not English or Bangla.

Tips for a cleaner result

  • Pick Body content only if you are pasting into a CMS, and Full page if you want a file you can open directly.
  • Use One <section> per page when you need to link or style individual pages afterwards.
  • Check headings first. The largest text size becomes h1, so a big title on every page, such as a running header, may appear many times.
  • Remove repeated headers, footers and page numbers by hand after converting. They are read like any other text.
  • If the markup will be reused in a page, compress it with the HTML Minifier, described in the HTML Minifier guide.
  • Want a Word file instead? Use PDF to Word, explained in the PDF to Word guide.

Common problems and how to fix them

"This PDF has no text layer…"

The PDF is a scan. Make it searchable with OCR Studio or PDF OCR, then convert the searchable file. The OCR guide, PDF OCR: making scanned PDFs searchable, shows how.

"No text could be read from this PDF."

The pages have nothing the tool can use. Check that you chose the right file, and try PDF to Text to see whether any text comes out.

A sentence is split across two paragraphs

Each page is rebuilt on its own, and the tool joins a paragraph that continues onto the next page only when it is safe (see the option above). When it is not sure, for example after a heading or a line ending in a full stop, you still get two <p> elements. Join them by hand in the code.

A two-column page reads strangely

Text from both columns that sits on the same baseline is joined into one line, so the columns are read across. Because left and right text can then look like two cells per line, the tool may also write such a page as a table. Treat the result of a multi-column layout as a starting point and tidy it.

Headings are missing or too many

Headings come only from larger text. If the PDF uses one size, there are none. If it uses many sizes, you may get more than you want. Edit the tags afterwards.

Characters look wrong

Check the PDF in a viewer first. If copy and paste from the PDF gives odd characters, the file uses a font with a custom encoding. For old Bangla Bijoy fonts, see Bijoy vs Unicode.

Quick checklist

  • Make sure the PDF has real text; OCR scans first.
  • Choose Body content only for a CMS, Full page for a file.
  • Check the Headings and Tables figures against your expectations.
  • Check the language attribute for text that is neither English nor Bangla.
  • Tidy repeated headers, footers and split paragraphs by hand.

Frequently asked questions

Will the HTML look like my PDF?
No. You get the content as clean markup: paragraphs, headings, lists and tables. Fonts, colours, columns, pictures, links and exact positions are not reproduced, so it reads like a simple web page, not a copy of the pages.
Why does the tool say my PDF has no text layer?
The PDF is made of pictures, usually a scan. HTML needs real text, so run the PDF through OCR Studio or PDF OCR first and convert the searchable result.
How does the tool decide what is a heading?
By text size. Lines that are clearly larger than the body text become h1, h2 or h3, with the largest size as h1. A PDF that uses one text size everywhere has no headings to find.
What does the Styles setting change?
It only matters for the Full page output. Minimal adds a small style sheet in the head so the page reads well in a browser. None leaves it out and writes plain tags only. Body content only has no style sheet either way.
Is the HTML safe to open or paste into my site?
All text is escaped, so nothing in the PDF can run as a script, and links are not created. The preview runs in a sandboxed frame with scripts turned off. As with any pasted markup, read it over before you publish it.
Found this useful? Share it

Tools in this guide

Main tool

PDF to HTML

Turn the text of a PDF into clean, semantic HTML.

Open tool

PDF to Text

Pull the text out of any PDF and copy it or save it as a .txt file.

Open tool

OCR Studio

Drop pictures and PDFs together and get their text, searchable PDFs, or both.

Open tool

HTML to PDF

Turn HTML code or a saved web page into a clean PDF without installing anything.

Open tool

Back to all guides & blog