Getting a PDF's text onto a web page as clean HTML
Someone has handed you a report, a policy or an article as a PDF, and it needs to live on a web page. Copying from a PDF viewer gives you broken lines and lost headings. What most of these jobs need is the text with its structure marked up, so your own site's design can take over, and that is what this tool writes.
Updated
Which tool you need
Article or policy text to paste into a website or content editor
PDF to HTML. You get one plain page of headings, lists and paragraphs that a CMS or a site template can style however it styles everything else.
The same text for a wiki, a repository or a Markdown editor
PDF to Markdown reads the page the same way and writes Markdown instead of tags.
A web version that looks exactly like the printed page
Nothing here rebuilds a PDF's layout in HTML. Linking to the PDF keeps its look; if a picture of each page is enough, PDF to Image makes one.
Text to read on an e-reader rather than publish
PDF to EPUB writes a book file whose text reflows to the screen.
What the markup contains
A complete HTML document: a doctype, a UTF-8 character set, a viewport line for phones and a title, which is the file's name unless you type another. Inside a single main element come h1 to h3 headings, ul and ol lists and p paragraphs, with no class names, inline styles or scripts.
Numbered lists keep the document's own numbers through start and value attributes, so a list that begins at 4 still begins at 4. With pages kept in their own sections, each one is wrapped in a section whose id is page-1, page-2 and so on, which a link can jump to.
Why no styling comes with it
What the reading pass gets from a PDF is where each piece of text sits and how large it is. The font, the weight and the color do not survive that reading, so any stylesheet written here would be a guess dressed up as a copy.
Leaving it out is also what makes the markup easy to use: pasted into a content editor or a site template, it picks up that site's fonts and spacing with nothing to strip out first.
Where the structure is worth checking
Headings are decided by size against the type most of the text is set in, measured over the pages you selected. A heading that is only bold, at the same size as the body, is written as a paragraph, and a section set noticeably larger than the rest can have its short lines promoted to headings.
Columns are read one after the other rather than side by side, and words broken across lines are joined. A quick look at the preview before downloading shows whether a designed layout came through in the order you expect.
What to know before you start
- Pictures, links, colors and fonts are not carried into the HTML.
- A table's words come through, but not as an HTML table.
- The page is marked lang="en" whatever language the PDF is in, so edit that attribute for another language.
- Scanned pages have no text to read and are listed in the result; a PDF with no text at all is refused.
- A page with more text than a single read can take is cut short, and the result says so.