PDF to HTML API Guide
Convert PDF text into readable HTML with page order and line breaks. Upload a PDF or provide a public URL.
PDF to HTML API Guide
Convert PDF text into readable HTML. Keep page order, multilingual text, and line breaks in a browser-friendly document.
View API details or try the Demo.
What you can build
- Make text-based PDFs easier to read on desktop and mobile.
- Prepare document text for search, indexing, and content workflows.
- Convert uploaded files or public PDF links into downloadable HTML.
This API extracts existing text. It does not reproduce images or complex page layouts, and it does not perform OCR on scanned documents. For HTML, plain text, Markdown, or JSON returned directly in the response, use PDF Text Conversion.
Request
Send POST https://api.gugudata.io/v1/imagerecognition/pdf2html with the AppKey in the query string. Provide exactly one multipart input:
| Parameter | Meaning |
|---|---|
file |
PDF upload, at most 20 MiB and 100 pages. |
file_url |
Public HTTP/HTTPS PDF URL, at most 2048 characters; use instead of file. |
Upload a PDF
curl 'https://api.gugudata.io/v1/imagerecognition/pdf2html?appkey=YOUR_APPKEY' \
-F 'file=@./document.pdf'
Use a public PDF link
curl 'https://api.gugudata.io/v1/imagerecognition/pdf2html?appkey=YOUR_APPKEY' \
-F 'file_url=https://storage.gugudata.io/pdf/demo.pdf'
The four-page input PDF is also used by the Demo. Both input methods use the same limits. Password-protected, damaged, and textless PDFs cannot be converted.
Response
A successful response contains data.htmlUrl, an HTTPS download URL. The response shape below is illustrative; each conversion returns its own generated URL.
{
"dataStatus": {
"requestParameter": "source=url&type=html&bytes=86573&pages=4",
"statusCode": 200,
"status": "SUCCESS",
"statusDescription": "successfully",
"responseDateTime": "2026-09-06 06:34:26+0000",
"dataTotalCount": 1
},
"data": {
"htmlUrl": "https://storage.gugudata.io/pdf2html/GENERATED_ID.html"
}
}
Open htmlUrl in a browser or download it. The file is UTF-8 HTML with numbered page sections and preserved line breaks. Extracted text is escaped for safe display. The HTML output is limited to 20 MiB.
Result links are public. Anyone with a link can access the file. Download and retain your own copy; permanent availability is not guaranteed. Do not use this public-output endpoint for documents that require restricted access.
The Demo performs a real conversion and caches its result for 15 minutes. X-GuGuData-Demo-Mode is live or cached; X-GuGuData-Generated-At indicates when the result was generated. The Demo’s request parameters identify the public input PDF.
Errors
| HTTP status | Meaning |
|---|---|
| 400 | Missing or conflicting inputs, or invalid parameters. Business code 400. |
| 401 / 403 | Missing, invalid, or unauthorized AppKey; existing authorization rules apply. |
| 413 | PDF exceeds 20 MiB or 100 pages. Business code 500. |
| 422 | Invalid, encrypted, or textless PDF, or HTML output exceeds 20 MiB. Business code 500. |
| 429 | Request quota or rate limit reached. |
| 500 | Unexpected processing failure. |
| 502 | PDF URL cannot be retrieved, or conversion returned an invalid result. Business code 500. |
| 503 | Conversion or file storage is temporarily unavailable. Business code 500. |
Check both HTTP status and dataStatus.statusCode. A failed request does not contain a successful htmlUrl. Correct invalid inputs before retrying; avoid immediate repeated conversion requests.
Related APIs
See the OpenAPI specification for the complete request and response contract.