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 StringDLL
const wchar_t* DLExportPageHTML(int InstanceID, int Page, int Options);
const char* DLExportPageHTMLA(int InstanceID, int Page, int Options);Parameters
| Page | The one-based page number |
|---|---|
| Options | Zero 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
Common bold, italic, and oblique font-name styles are retained in CSS. Each page has an accessible region name and a focusable fragment target for page navigation
Print styles remove the viewing background and page shadows and place each exported PDF page on a separate printed page
Text and images are extracted in one rendering pass and retain their PDF geometry inside a fixed-size page container; image transforms convert PDF points to CSS pixels at 96 pixels per 72 points, including rotated or skewed images
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