ExportDocumentHTML

Text, images, extraction, HTML

Description

Exports a selected page range into one standalone HTML5 document with one positioned section per distinct selected page, in selection order. Internal links to pages outside the export are omitted. When PDF_HTML_INCLUDE_TOC is set, the table of contents includes bookmarks whose destinations are in the exported range

Syntax

Delphi

Function TPDFlib.ExportDocumentHTML(Const PageRange: WideString;
  Options: Integer): WideString;

ActiveX

Function PDFlib::ExportDocumentHTML(PageRange As String, Options As Long) As String

DLL

const wchar_t* DLExportDocumentHTML(int InstanceID, const wchar_t* PageRange, int Options);
const char* DLExportDocumentHTMLA(int InstanceID, const char* PageRange, int Options);

Parameters

PageRangeA one-based range such as 1-3,7, or an empty string for every page; explicit page order is preserved
OptionsZero selects PDF_HTML_DEFAULT; otherwise combine the image, link, and text inclusion flags documented by ExportPageHTML, plus PDF_HTML_INCLUDE_TOC (8) which prepends a table-of-contents nav built from the outline tree, linking each entry to its page anchor

Return values

Returns one self-contained HTML5 document, or an empty string when validation, cancellation, or extraction fails

Remarks

Only the current page funnel and its encoded image data are retained while the output is assembled, so extraction memory follows the most complex selected page rather than the page count

Internal link annotations target stable #page-N anchors inside the generated document

The selected page is restored before the call returns

Progress and cooperative cancellation use the normal document operation lifecycle

LastErrorCode is 112 for invalid range or options and 516 when export fails

See also

ExportPageHTML, ExtractStructuredDocument, RenderDocumentToFile