Skip to content
ComPDF

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
HtmlOptionSinglePageConvert the entire PDF into one HTML file, with all PDF pages connected in page order on the same HTML page.
HtmlOptionSinglePageWithBookmarkConvert the PDF into one HTML file with an outline for navigation at the beginning of the page, while all PDF pages remain connected on the same HTML page.
HtmlOptionMultiPageConvert the PDF into multiple HTML files. Each HTML file corresponds to one PDF page, and users can navigate to the next file through a link at the bottom of the page.
HtmlOptionMultiPageWithBookmarkConvert the PDF into multiple HTML files, one per PDF page, and provide an outline HTML file for navigation.

Sample

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

objective-c
HtmlOptions *options = [[HtmlOptions alloc] init];
[CPDFConversion startPDFToHtml:@"html.pdf" password:@"password" outputPath:@"path/output.html" options:options];

options.pageLayoutMode = PageLayoutModeBox;
options.htmlPageOption = HtmlOptionMultiPageWithBookmark;
[CPDFConversion startPDFToHtml:@"html.pdf" password:@"password" outputPath:@"path/output-multi.html" options:options];