PdfPage.ToSvgString Method
Converts this page to an SVG string. The string can for example be saved to a file, or inlined in HTML.
public string ToSvgString( SvgConversionOptions? options = null, CancellationToken cancellationToken = default )
Parameters
- options SvgConversionOptions (Optional)
- Additional configuration options for the conversion.
- cancellationToken CancellationToken (Optional)
- Token for monitoring cancellation requests.
Return Value
StringSVG fragment without XML declaration. The fragment can be saved to a file or included as inline SVG in HTML.
Exceptions
Exception | Condition |
---|---|
PermissionException | Content extraction from this document is forbidden by the document author. Not thrown if the document is opened with the owner password. |
PdfException | The conversion failed, possibly because of a malformed PDF. |
Remarks
Note that if you parse the returned SVG fragment as XML, you need to preserve space and not add indentation. Text content will otherwise not render correctly.