Skip to content
ComPDF
DemoFAQ

Convert PDF to HTML

Overview

ComPDF Conversion SDK provides the PDF to HTML function, which can convert PDF files to HTML files while maintaining the layout and format of the original document, allowing users to browse and view the document on Web.

Notice

When converting PDF to HTML format, ComPDF Conversion SDK provides the following four options to create HTML files:

OptionDescription
HtmlPageOption.SINGLE_PAGEConvert the entire PDF file into a single HTML file, where all PDF pages are connected in sequence by page number, displayed on the same HTML page.
HtmlPageOption.SINGLE_PAGE_WITH_BOOKMARKConvert the PDF file into a single HTML file with all PDF page content on the same page in sequential order. This option also adds a bookmark navigation bar to the HTML page for quick navigation to a specific page.
HtmlPageOption.MULTIPLE_PAGEConvert the PDF file into multiple HTML files. Each HTML file corresponds to a PDF page, and users can navigate to the next page via a link at the bottom of the page.
HtmlPageOption.MULTIPLE_PAGE_WITH_BOOKMARKConvert the PDF file into multiple HTML files, each corresponding to a PDF page. An outline HTML page is provided for navigation, allowing users to jump to the corresponding HTML page by clicking the outline.

Sample

This sample demonstrates how to convert from a PDF to HTML file.

java
HtmlOptions opt = new HtmlOptions();
CPDFConversion.startPDFToHtml("html.pdf", "password", "path/output.html", opt);