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 (see Password). |
PdfException | The conversion failed, possibly because of a malformed PDF. |
OperationCanceledException | The operation was cancelled because the cancellation token was triggered. |
Remarks
Note
If you parse the XML returned from PdfToSvg.NET, you need to preserve space and not add indentation. Otherwise text will not be rendered correctly in the modified markup.