PdfPage.ToSvgStringAsync Method

Converts this page to an SVG string asynchronously. The string can for example be saved to a file, or inlined in HTML.

public Task<string> ToSvgStringAsync(
	SvgConversionOptions? options = null,
	CancellationToken cancellationToken = default
)
Namespace
PdfToSvg
Package
PdfToSvg.NET (since v0.2.0)

Parameters

options  SvgConversionOptions  (Optional)
Additional configuration options for the conversion.
cancellationToken  CancellationToken  (Optional)
Token for monitoring cancellation requests.

Return Value

Task<String>
SVG fragment without XML declaration. The fragment can be saved to a file or included as inline SVG in HTML.

Exceptions

ExceptionCondition
PermissionExceptionContent extraction from this document is forbidden by the document author. Not thrown if the document is opened with the owner password (see Password).
PdfExceptionThe conversion failed, possibly because of a malformed PDF.
OperationCanceledExceptionThe 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.

See Also

PdfPage Class
PdfToSvg Namespace