.NET API reference
The easiest way of getting started with PdfToSvg.NET is by installing the NuGet package.
PM> Install-Package PdfToSvg.NET
Open a PDF document by calling PdfDocument.Open(). Then use either SaveAsSvg() or ToSvgString() to save each page as SVG.
using (var doc = PdfDocument.Open("input.pdf")) { var pageNo = 1; foreach (var page in doc.Pages) { page.SaveAsSvg($"output-{pageNo++}.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.
Note
If you parse the XML returned from PdfToSvg.NET, you must preserve space and not add indentation. Otherwise text will not be rendered correctly in the modified markup.
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. | |
| FontRepository | Contains fonts to be used if a PDF document refers to a non-embedded font. | |
| 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. | |
| ImageEnumerable | Provides access to images embedded 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. | |
| OptionalContentGroup | Represents an optional content group (OCG) in the PDF document. An optional content group can be seen as a layer, whose visibility can be controlled individually. | |
| OptionalContentGroupCollection | Contains a readonly collection of optional content groups from a PDF document. | |
| 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. |