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 String

DLL

const wchar_t* DLExportPageSVG(int InstanceID, int Page, int Options);
const char* DLExportPageSVGA(int InstanceID, int Page, int Options);

Parameters

PageThe one-based page number
OptionsZero 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, miter, 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

Pattern and shading paints use a black fallback, arbitrary clipping paths are represented by their effective bounds, and vector paths inside Form XObjects are not expanded

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

See also

ExportPageSVGToFile, DrawSVG, ExportPageHTML