PdfSvg class
Namespace: PdfNetStack.Drawing
Assembly: PdfNetStack.dll
Package: PdfNetStack
An SVG drawing, placed as vector graphics: it stays sharp at any zoom and its text stays text. Each drawing is written once per document and reused wherever it is placed. Supported: shapes, paths, groups, use and symbol, nested viewports, solid colors and linear and radial gradients, clip paths, opacity, text in the standard fonts, embedded JPEG and PNG images, and style sheets with type, class and id selectors. Not supported: filters, masks, patterns, external references and animation.
public sealed class PdfSvgInheritance
Examples
Section titled “Examples”PdfSvg logo = PdfSvg.Load("logo.svg");
using PdfGraphics g = page.CreateGraphics();
g.DrawSvg(logo, 40, 40, 120, 40);
Properties
Section titled “Properties”Height
Section titled “ Height”Height in points at the drawing’s own size.
public double Height { get; }Property Value
Section titled “Property Value”Width in points at the drawing’s own size, CSS pixels at 96 per inch.
public double Width { get; }Property Value
Section titled “Property Value”Methods
Section titled “Methods”Load(string)
Section titled “ Load(string)”Loads an SVG file, UTF-8 unless it starts with a byte order mark.
public static PdfSvg Load(string path)Parameters
Section titled “Parameters”path string
Returns
Section titled “Returns”Exceptions
Section titled “Exceptions”The file is not SVG.
Load(Stream)
Section titled “ Load(Stream)”Loads SVG from a stream, up to 32 MiB.
public static PdfSvg Load(Stream stream)Parameters
Section titled “Parameters”stream Stream
Returns
Section titled “Returns”Exceptions
Section titled “Exceptions”The data is not SVG.
Load(byte[])
Section titled “ Load(byte[])”Loads SVG from bytes, UTF-8 unless they start with a byte order mark.
public static PdfSvg Load(byte[] data)Parameters
Section titled “Parameters”data byte[]
Returns
Section titled “Returns”Exceptions
Section titled “Exceptions”The data is not SVG.
Parse(string)
Section titled “ Parse(string)”Parses SVG markup.
public static PdfSvg Parse(string svg)Parameters
Section titled “Parameters”svg string
Returns
Section titled “Returns”Exceptions
Section titled “Exceptions”The text has no svg root element.