Skip to content
ComPDF
DemoFAQ
New Release

Open-Source PDF SDK & AI Document Processing

Get the full self-hosted SDK and AI document processing on GitHub. One-click deploy to quickly build your document workflows.

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.

HTML Options

OptionValueDescription
SINGLE_PAGE0Convert the entire PDF into a single HTML file.
SINGLE_PAGE_WITH_BOOKMARK1Convert the PDF into a single HTML file with a bookmark navigation bar.
MULTI_PAGE2Convert the PDF into multiple HTML files, one file per page.
MULTI_PAGE_WITH_BOOKMARK3Convert the PDF into multiple HTML files with an outline page for navigation.

Sample

js
const options = {
  htmlOption: 0
};

const result = sdk.startPDFToHtml(
  inputFilePath,
  "",
  outputFilePath,
  options
);