PdfToSvg Namespace
To convert a PDF file to SVG, start by creating a PdfDocument. Then use either SaveAsSvg(String, SvgConversionOptions, CancellationToken) or ToSvgString(SvgConversionOptions, CancellationToken) to save each page as SVG.
Convert PDF to SVG
using (var doc = PdfDocument.Open("input.pdf")) { var pageIndex = 0; foreach (var page in doc.Pages) { page.SaveAsSvg($"output-{pageIndex++}.svg"); } }
By default, PdfToSvg.NET will try to extract fonts embedded in the PDF and embed them in the output SVG as data URLs. This behavior can be changed by specifying another FontResolver.
Classes
DocumentInfo | Provides information about a PDF document. | |
DocumentPermissions | Provides information about which operations to a PdfDocument that are allowed by the document author. | |
FileAttachment | Provides access to an embedded file attached to a PDF document. | |
FileAttachmentCollection | Read only collection of files attached to a PDF page. | |
Font | Represents a substitute font to be used in the generated SVG markup. | |
FontResolver | Resolves which font to be used for text in the SVG, for a given PDF font name. | |
Image | Provides information about an image in a PDF document. | |
ImageResolver | Resolves an image URL for an image encountered in a PDF document. | |
InlinedFont | Represents a font whose glyphs are inlined as paths and other elements within the SVG markup. | |
InvalidCredentialException | Represents errors that occur when a document is password protected, but an incorrect password is specified or not specified at all. | |
LocalFont | Represents a font that is assumed to be installed on the machine viewing the SVG. | |
OpenOptions | Provides additional configuration options for opening a PdfDocument. | |
PdfDocument | Contains information about a loaded PDF file. | |
PdfException | Represents errors that can occur while loading and converting a PDF file. This is the base class for all library specific exceptions. | |
PdfPage | Represents a single page in a PDF document. | |
PdfPageCollection | Read only collection of PdfPage objects. | |
PermissionException | Represents errors that occurs when an attempt is made to perform an operation not allowed by the document author. | |
SourceFont | Contains information about a font used in the PDF document. | |
SvgConversionOptions | Contains options affecting the behavior when a PDF page is converted to SVG. | |
WebFont | Uses a web font in the resulting SVG markup. |
Enumerations
FontStyle | Specifies font styles. | |
FontWeight | Specifies font weights. |