ExportPageHTML

Text, images, extraction, HTML

Description

Exports one PDF page as a standalone HTML5 document with positioned text, embedded images, and clickable annotation links

Syntax

Delphi

Function TPDFlib.ExportPageHTML(Page, Options: Integer): WideString;

ActiveX

Function PDFlib::ExportPageHTML(Page As Long, Options As Long) As String

DLL

const wchar_t* DLExportPageHTML(int InstanceID, int Page, int Options);
const char* DLExportPageHTMLA(int InstanceID, int Page, int Options);

Parameters

PageThe one-based page number
OptionsZero selects PDF_HTML_DEFAULT; otherwise combine PDF_HTML_INCLUDE_IMAGES (1), PDF_HTML_INCLUDE_LINKS (2), and PDF_HTML_INCLUDE_TEXT (4)

Return values

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

Remarks

Text and images are extracted in one rendering pass and positioned in PDF points inside a fixed-size page container

Raster images are encoded as PNG data URIs, including image masks where available, so the result has no external image dependencies

URI annotations become safe clickable overlays and internal destinations become #page-N anchors

URI schemes that can execute script are omitted from the output

The selected page is restored before the call returns

DLL return pointers remain valid until the next string-returning call on the same instance

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

See also

ExportDocumentHTML, ExtractStructuredPage, RenderPageToStream