# PdfSvg class

> 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...

Namespace: [PdfNetStack.Drawing](https://www.jadev-corp.com/api/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.

```csharp
public sealed class PdfSvg
```

**Inheritance**

[object](https://learn.microsoft.com/dotnet/api/system.object) ← 
[PdfSvg](https://www.jadev-corp.com/api/pdfnetstack-drawing/pdfsvg/)

## Examples

<pre><code class="lang-csharp">PdfSvg logo = PdfSvg.Load("logo.svg");
using PdfGraphics g = page.CreateGraphics();
g.DrawSvg(logo, 40, 40, 120, 40);</code></pre>

## Properties

### <a id="PdfNetStack_Drawing_PdfSvg_Height"></a> Height

Height in points at the drawing's own size.

```csharp
public double Height { get; }
```

#### Property Value

 [double](https://learn.microsoft.com/dotnet/api/system.double)

### <a id="PdfNetStack_Drawing_PdfSvg_Width"></a> Width

Width in points at the drawing's own size, CSS pixels at 96 per inch.

```csharp
public double Width { get; }
```

#### Property Value

 [double](https://learn.microsoft.com/dotnet/api/system.double)

## Methods

### <a id="PdfNetStack_Drawing_PdfSvg_Load_System_String_"></a> Load\(string\)

Loads an SVG file, UTF-8 unless it starts with a byte order mark.

```csharp
public static PdfSvg Load(string path)
```

#### Parameters

`path` [string](https://learn.microsoft.com/dotnet/api/system.string)

#### Returns

 [PdfSvg](https://www.jadev-corp.com/api/pdfnetstack-drawing/pdfsvg/)

#### Exceptions

 [FormatException](https://learn.microsoft.com/dotnet/api/system.formatexception)

The file is not SVG.

### <a id="PdfNetStack_Drawing_PdfSvg_Load_System_IO_Stream_"></a> Load\(Stream\)

Loads SVG from a stream, up to 32 MiB.

```csharp
public static PdfSvg Load(Stream stream)
```

#### Parameters

`stream` [Stream](https://learn.microsoft.com/dotnet/api/system.io.stream)

#### Returns

 [PdfSvg](https://www.jadev-corp.com/api/pdfnetstack-drawing/pdfsvg/)

#### Exceptions

 [FormatException](https://learn.microsoft.com/dotnet/api/system.formatexception)

The data is not SVG.

### <a id="PdfNetStack_Drawing_PdfSvg_Load_System_Byte___"></a> Load\(byte\[\]\)

Loads SVG from bytes, UTF-8 unless they start with a byte order mark.

```csharp
public static PdfSvg Load(byte[] data)
```

#### Parameters

`data` [byte](https://learn.microsoft.com/dotnet/api/system.byte)\[\]

#### Returns

 [PdfSvg](https://www.jadev-corp.com/api/pdfnetstack-drawing/pdfsvg/)

#### Exceptions

 [FormatException](https://learn.microsoft.com/dotnet/api/system.formatexception)

The data is not SVG.

### <a id="PdfNetStack_Drawing_PdfSvg_Parse_System_String_"></a> Parse\(string\)

Parses SVG markup.

```csharp
public static PdfSvg Parse(string svg)
```

#### Parameters

`svg` [string](https://learn.microsoft.com/dotnet/api/system.string)

#### Returns

 [PdfSvg](https://www.jadev-corp.com/api/pdfnetstack-drawing/pdfsvg/)

#### Exceptions

 [FormatException](https://learn.microsoft.com/dotnet/api/system.formatexception)

The text has no svg root element.

## Used in

- [Add images to PDF in C# and .NET](https://www.jadev-corp.com/guides/images/)

Source: https://www.jadev-corp.com/pdfnetstack/api/pdfnetstack-drawing/pdfsvg/
