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

OptionDescription
HtmlOption::SINGLE_PAGEConvert the entire PDF into a single HTML file.
HtmlOption::SINGLE_PAGE_WITH_BOOKMARKConvert the PDF into a single HTML file with a bookmark navigation bar.
HtmlOption::MULTI_PAGEConvert the PDF into multiple HTML files, one file per page.
HtmlOption::MULTI_PAGE_WITH_BOOKMARKConvert the PDF into multiple HTML files with an outline page for navigation.

Sample

ruby
options = ComPDFKitConversion::ConvertOptions.new
options.html_option = ComPDFKitConversion::HtmlOption::SINGLE_PAGE

result = ComPDFKitConversion::Conversion.start_pdf_to_html(
  input_file_path,
  "",
  output_file_path,
  options
)