ExportPageSVG
Vector graphics, SVG, extraction
Description
Exports one PDF page as a standalone scalable vector graphic with native paths, searchable text, embedded raster images, and clickable annotation links
Syntax
Delphi
Function TPDFlib.ExportPageSVG(Page, Options: Integer): WideString;ActiveX
Function PDFlib::ExportPageSVG(Page As Long, Options As Long) As StringDLL
const wchar_t* DLExportPageSVG(int InstanceID, int Page, int Options);
const char* DLExportPageSVGA(int InstanceID, int Page, int Options);Parameters
| Page | The one-based page number |
|---|---|
| Options | Zero selects PDF_SVG_DEFAULT; otherwise combine PDF_SVG_INCLUDE_PATHS (1), PDF_SVG_INCLUDE_IMAGES (2), PDF_SVG_INCLUDE_TEXT (4), PDF_SVG_INCLUDE_LINKS (8), and PDF_SVG_TRANSPARENT_BACKGROUND (16) |
Return values
Returns a self-contained UTF-16 SVG document, or an empty string when validation or extraction fails
Remarks
Painted page paths retain transforms, fill and stroke colours, opacity, line width, cap, join, mitre, dash, even-odd fill, and bounded clipping as SVG path attributes
Text remains searchable and images are embedded as PNG data URIs with a 128 MiB per-image limit, so successful output has no external image dependencies
URI annotations become clickable overlays and internal destinations become #page-N links, while script-capable URI schemes are omitted
Page paths, text and images retain their original paint order, nested Form invocations are expanded, and clipping keeps path geometry and intersection order
The selected page is restored before the call returns and DLL return pointers remain valid until the next string-returning call on the same instance
LastErrorCode is 119 for an invalid page or options and 522 when export fails
Unsupported patterns, shading, soft masks and compositing request a bounded native raster snapshot of the prior paints and the affected operation, with no later paints included; the source document remains unchanged
Opaque fallback is rejected for transparent output or when paint categories have been excluded; inspect GetLastSVGExportDiagnostics for omitted pixels and approximations before accepting the output
Browser font substitution and device colour conversion can approximate the rendering; visible annotation appearances outside page content are disclosed as pixel loss