NewAPIVerve Academy: free courses and certifications anyone can verify.Explore the Academy →

PDF to HTML API

POST

Convert PDF pages to self-contained HTML with the original fonts, images and layout.

PDF to HTML converts the pages of a PDF, uploaded or fetched from a URL, into one self-contained HTML file that looks like the original: same layout, embedded fonts and images, and real selectable text. Choose a page range, unlock password-protected PDFs, or ask for text only; long documents are converted in batches, with nextPage pointing to the next one.

Try it — live request, no key required

Request
POSTapi.apiverve.com/v1/pdftohtml
pdf
Click or drag a file to upload.pdf · max 400KB for live testing
Verification
Format

No key required to try it. Get a key to use it in your app.

Example
{
  "status": "ok",
  "error": null,
  "data": {
    "htmlName": "7c1e4b9a-2f3d-4e8a-9b6c-5d0a1f2e3c4b.html",
    "pageCount": 14,
    "firstPage": 1,
    "lastPage": 10,
    "pagesConverted": 10,
    "nextPage": 11,
    "textOnly": false,
    "encrypted": false,
    "size": 1873402,
    "inline": false,
    "html": null,
    "expires": 1792400000000,
    "downloadURL": "https://storage.googleapis.com/apiverve/APIData/pdftohtml/7c1e4b9a-2f3d-4e8a-9b6c-5d0a1f2e3c4b.html?GoogleAccessId=635500398038-compute%40developer.gserviceaccount.com&Expires=1792400000&Signature=SAMPLE"
  }
}

About the PDF to HTML API

Conversion uses pdf2htmlEX, which places every line of text where it sits in the PDF using the PDF's own fonts, converted to web fonts and embedded in the file, and draws images and vector graphics as a background layer. The HTML needs no other files, so it can be stored, emailed or shown in an iframe as it is.

Paid plans convert up to 10 pages per call and the Free plan 2; pageCount gives the length of the document and nextPage the page to send next. textOnly leaves out the background layer for smaller files that keep just the positioned text. HTML up to 512 KB is returned in the response; every result is also stored behind a download link valid for 2 days.

How it works

Pages are converted by pdf2htmlEX 0.18.8, which uses Poppler to read the PDF. Every text run becomes an absolutely positioned element in the PDF's own font: embedded fonts are extracted, re-encoded so their characters map to Unicode, and inlined as WOFF web fonts, and fonts the PDF only names are matched to metric-compatible system fonts. Everything that is not text (images, vector paths, shading) is rendered into one PNG background image per page. CSS, fonts and images are all embedded, so the output is a single HTML file with no external references; pages are div elements with ids pf1, pf2 and so on, numbered by their position in the PDF.

pages takes one page (3), a closed range (2-7) or an open range (5-, to the end); the default is the whole document from page 1. Each call converts at most 10 pages from the start of the range (2 on the Free plan); nextPage is the first page left in the requested range, or null, so a loop that sends pages=<nextPage>- walks the document. Page numbers past the end return 400 with the page count. The PDF is checked with Poppler's pdfinfo first: an encrypted file without password returns 400 "password-protected", a wrong password 400 "not correct". Copy-restriction flags are not enforced.

textOnly turns off the background layer, so only positioned text remains; it is much smaller and suits indexing. HTML up to 512 KB is returned in html and inline is true; larger output has html null and is read from downloadURL, a signed link valid for two days (expires, Unix milliseconds). A conversion has 22 seconds; image-heavy pages that take longer return 504, and a call whose HTML would pass 30 MB returns 413, so convert fewer pages or use textOnly. Scanned PDFs without a text layer come out as background images only.

What people use it for

Documents in the Browser
Show invoices, statements and reports inside your web app as HTML instead of sending users a PDF download.
Searchable Archives
Turn PDF archives into HTML pages that search engines and site search can index, with the original look intact.
Email and CMS Publishing
Publish brochures, menus and newsletters made as PDFs on a website or in a CMS without retyping them.
Accessibility Workflows
Get selectable, copyable text in its original position as a starting point for accessible versions of PDF documents.

Ways to call it

One endpoint, many ways in — REST with JSON, XML, YAML and CSV, plus GraphQL and an MCP interface for AI agents.

JSON
Default REST response
XML
Markup format
YAML
Human-readable
CSV
Tabular export
Beta
GraphQL
Query language
New
MCP
For AI agents

Other ways to use PDF to HTML

Same data, same APIVerve account, same credit balance — one key works on all of them.

Questions.

Common questions about the PDF to HTML API.

Read the docs →
Does the HTML look like the PDF?
Yes. Text is placed where it is in the PDF, in the PDF's own fonts embedded as web fonts, and images and drawings are kept as a background layer. Text stays real text you can select, copy and search.
Can I convert password-protected PDFs?
Yes. Send the PDF's user or owner password in password. Without it, an encrypted PDF returns a 400 saying a password is needed; a wrong password returns a 400 saying so.
How do I convert a long document?
Each call converts up to 10 pages (2 on the Free plan). The response gives pageCount and nextPage; send pages set to nextPage followed by a dash, such as 11-, to continue, until nextPage is null. A range such as 3-7 converts just those pages.
What does textOnly do?
textOnly leaves out the background layer, so images, shapes and lines are dropped and only the positioned text in its fonts remains. Files are much smaller, which suits search indexing and text extraction with layout.
What does the Free plan include?
The Free plan converts 2 pages per call with every option, including passwords and textOnly, and uploads are limited to 400 KB. Paid plans convert up to 10 pages per call from PDFs up to 10 MB.
How much does a conversion cost?
Each request costs 20 credits, whether it converts one page or a full batch. Starter covers 10,000 requests a month, about $0.003 per request. The Free plan includes 10 requests a month.
How long is the HTML kept?
The download link is a signed URL that expires after 2 days, given in expires as a Unix timestamp in milliseconds. HTML up to 512 KB is also returned in the html field.

Ready to build with PDF to HTML? Start with 200 free credits — one key unlocks all 300+ APIs.

Explore the catalog

300+ APIs on the same key and the same response shape.

Browse all APIs