PDF to HTML
Convert PDF to HTML: the text of a PDF as a standalone web page, one section per PDF page.
Your files stay on this device. Nothing is uploaded. How to check
How to use PDF to HTML
Key features of PDF to HTML
The output is a complete document with its own inline styles, a header showing the file name and page count, and one section per PDF page. It opens in any browser with no other files.
Images, links, fonts, tables and the original layout are not carried over. Headings are guessed from line length and capitalisation, so check them before publishing.
The PDF is read and the HTML is built by JavaScript in your browser. Nothing is sent to a server, and there is no account or watermark.
About PDF to HTML
PDF to HTML reads each page with pdf.js and groups text runs into lines by their vertical position. The first line on a page, if under 60 characters, and any line under 40 characters written in capitals become h2 headings; every other line becomes a paragraph. The lines are wrapped in a section per page inside a styled document, and a page with no text gets a placeholder note instead.
It is a quick way to get the words of a PDF onto a web page, into a CMS that accepts HTML, or into a form you can restyle with your own CSS. The heading guess is simple, so a date or a short first line may be marked as a heading. A scanned PDF has no text layer and comes out as placeholder sections only; run it through OCR PDF first.
When to use PDF to HTML
Meeting minutes, a newsletter or a notice needs to go out as a link rather than an attachment. Convert the PDF, download the .html and put it on any web space; it is one file with its styles inline, and it opens in a browser with nothing else to install.
A reader who uses a screen reader or a large text size finds a fixed-layout PDF hard going. The HTML output has a viewport tag and a container that wraps at 800 pixels, so the text reflows on a phone and follows the browser's text size, and the headings give the screen reader something to navigate by.
You want to process the text with a script. The output wraps each PDF page in a section element with a Page N of M label and uses only h2 and p tags inside it, which is easy to query and strip. If the destination takes Markdown instead, PDF to Markdown applies the same line grouping and writes ## headings and - bullets.
When the page has to look like the PDF, keep the PDF: link to it, or render pages to images with PDF to JPG and embed those. For the reverse direction, HTML to PDF turns a web page back into a document. A scan gives placeholder sections only; run it through OCR PDF first.
Tips and troubleshooting
- Failed to convert PDF to HTML: No password given means the PDF needs a password to open. Remove the protection first; copy restrictions alone do not stop it.
- Failed to convert PDF to HTML: Invalid PDF structure means the dropped file is not a PDF.
- Any line under 40 characters that contains no lower-case letters counts as capitals and becomes an h2, which includes dates, amounts and bare numbers. Demote those in the box before you copy.
- The first line of every page becomes an h2 if it is under 60 characters, so a running header repeats as a heading on each page. Delete the repeats or turn them into paragraphs.
- Each line of the PDF becomes its own p element; wrapped lines are not joined into paragraphs. If you need paragraphs rebuilt, PDF to Word joins wrapped lines by their spacing.
- The h1 in the output is your file name and the title is the name without its extension, followed by a line reading Converted with PDFTools.studio and a badge with the page count. Edit or remove them in the box before you copy.
- Copy HTML copies the box as it is, including your edits; Download File saves the original generation, and Preview Document renders it in a frame. The file is named after your PDF with an .html extension, and files over 150 MB are refused before anything runs.
- To go the other way, HTML to PDF renders pasted HTML, an HTML file or a public web page as a PDF. For notes or a repository, PDF to Markdown writes the same text as a .md file.
- Pages that come out as placeholders are scans. How to make a scanned PDF searchable explains how to check a file and add the text layer this tool reads.
How PDF to HTML works in your browser
pdf.js parses the file in a worker fetched from cdnjs.cloudflare.com and returns each page's text runs with their positions. The script rounds each run's vertical position and starts a new line whenever it moves by more than 6 points, joining runs on the same line with a space. It then applies the heading test to each line, escapes ampersands and angle brackets, and writes an h2 or a p with inline styles. Each page's lines are wrapped in a section with a Page N of M label, and a page with no runs gets an italic placeholder instead.
The sections are inserted into a document template with a head containing the character set, a viewport tag, the title and a short style block, and a header showing the file name and page count. That string becomes a Blob of type text/html. The result card is drawn from the Blob, and the script appends a textarea holding the source and a Copy HTML button that uses the clipboard API. Preview Document loads the Blob into a frame through a temporary object URL and Download File saves it the same way. The output contains no scripts and references no external files, and nothing about your PDF leaves the tab.
Frequently asked questions
Does the HTML look like the PDF?
No. It contains the text, split into one section per page with headings and paragraphs. Images, links, fonts, columns and tables are not reproduced.
Can I see the HTML before downloading?
Yes. Preview Document opens the page in a viewer, and the full source is shown in an editable box under the result with a Copy HTML button.
What happens with a scanned PDF?
A scan has no text layer, so each page comes out as a placeholder note saying it holds image or graphical content. Run the file through OCR PDF first, then convert.
Does the HTML file need any other files to work?
No. The styles are inline and in one style block, there are no scripts, images or external stylesheets, and the file opens from a folder or a USB stick without a connection.
Why do my paragraphs come out as several short ones?
Because each line in the PDF becomes its own paragraph element; lines are not joined by spacing. Merge them in the box, or use PDF to Word, which joins wrapped lines into paragraphs.
Can I change how the page looks?
Yes. The markup is plain h2 and p elements with inline styles, so you can delete those style attributes and apply your own stylesheet, or edit the style block in the head. Change it in the box and copy, since the download is the original version.
Last reviewed