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:
| Option | Description |
|---|---|
HtmlOptionSinglePage | Convert the entire PDF into one HTML file, with all PDF pages connected in page order on the same HTML page. |
HtmlOptionSinglePageWithBookmark | Convert 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. |
HtmlOptionMultiPage | Convert 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. |
HtmlOptionMultiPageWithBookmark | Convert 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];