# OfficeDrawingSvgExporter

Exports dependency-free OfficeIMO drawings to SVG for consumers that need a portable visual fallback.

Class 

`OfficeIMO.Drawing`

**Namespace**

`OfficeIMO.Drawing`

**Assembly**

`OfficeIMO.Core`

**Source revision**

`ba882f6b0d07` with working tree changes

**Source**

[OfficeDrawingSvgExporter.cs:16](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeDrawingSvgExporter.cs#L16)

**Modifiers**

static

Exports dependency-free OfficeIMO drawings to SVG for consumers that need a portable visual fallback.

## Inheritance

- object
- OfficeDrawingSvgExporter

Filter members 

Show inherited

## Methods

ToSvg 6 overloads

`public static string ToSvg(OfficeDrawing drawing)` [#](#method-tosvg-officeimo-drawing-officedrawing)

[OfficeDrawingSvgExporter.cs:16](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeDrawingSvgExporter.cs#L16)

Converts a drawing to an SVG document.

Parameters

**drawing OfficeIMO.Drawing.OfficeDrawing required**

Drawing to export.

Returns

`string` SVG markup representing the drawing.

`public static string ToSvg(OfficeDrawing drawing, double scale)` [#](#method-tosvg-officeimo-drawing-officedrawing-double)

[OfficeDrawingSvgExporter.cs:26](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeDrawingSvgExporter.cs#L26)

Converts a drawing to an SVG document with a scaled output surface.

Parameters

**drawing OfficeIMO.Drawing.OfficeDrawing required**

Drawing to export.

**scale double required**

Scale applied to the exported SVG width and height.

Returns

`string` SVG markup representing the drawing.

`public static string ToSvg(OfficeDrawing drawing, double scale, OfficeSvgSizeUnit sizeUnit)` [#](#method-tosvg-officeimo-drawing-officedrawing-double-officeimo-drawing-officesvgsizeunit)

[OfficeDrawingSvgExporter.Surface.cs:14](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeDrawingSvgExporter.Surface.cs#L14)

Converts a drawing to an SVG document with an explicit root size unit.

Parameters

**drawing OfficeIMO.Drawing.OfficeDrawing required**

Drawing to export.

**scale double required**

Scale applied to the exported SVG width and height.

**sizeUnit OfficeIMO.Drawing.OfficeSvgSizeUnit required**

Unit written on the root width and height attributes.

Returns

`string` SVG markup representing the drawing.

`public static string ToSvg(OfficeDrawing drawing, double scale, OfficeSvgSizeUnit sizeUnit, IOfficeRasterImageCodec? imageCodec)` [#](#method-tosvg-officeimo-drawing-officedrawing-double-officeimo-drawing-officesvgsizeunit-officeimo-drawing-iofficerasterimagecodec)

[OfficeDrawingSvgExporter.Surface.cs:23](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeDrawingSvgExporter.Surface.cs#L23)

Converts a drawing to SVG and uses an optional shared codec for source images that require transcoding.

Parameters

**drawing OfficeIMO.Drawing.OfficeDrawing required**

**scale double required**

**sizeUnit OfficeIMO.Drawing.OfficeSvgSizeUnit required**

**imageCodec OfficeIMO.Drawing.IOfficeRasterImageCodec? required**

Returns

`string`

`public static string ToSvg(OfficeDrawing drawing, double scale, OfficeSvgSizeUnit sizeUnit, IOfficeRasterImageCodec? imageCodec, string? resourceIdPrefix)` [#](#method-tosvg-officeimo-drawing-officedrawing-double-officeimo-drawing-officesvgsizeunit-officeimo-drawing-iofficerasterimagecodec-string)

[OfficeDrawingSvgExporter.Surface.cs:33](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeDrawingSvgExporter.Surface.cs#L33)

Converts a drawing to SVG and prefixes every generated resource identifier for safe inline composition.

Parameters

**drawing OfficeIMO.Drawing.OfficeDrawing required**

**scale double required**

**sizeUnit OfficeIMO.Drawing.OfficeSvgSizeUnit required**

**imageCodec OfficeIMO.Drawing.IOfficeRasterImageCodec? required**

**resourceIdPrefix string? required**

Returns

`string`

`public static string ToSvg(OfficeDrawing drawing, double scale, OfficeSvgSizeUnit sizeUnit, IOfficeRasterImageCodec? imageCodec, string? resourceIdPrefix, CancellationToken cancellationToken)` [#](#method-tosvg-officeimo-drawing-officedrawing-double-officeimo-drawing-officesvgsizeunit-officeimo-drawing-iofficerasterimagecodec-string-threading-cancellationtoken)

[OfficeDrawingSvgExporter.Surface.cs:44](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeDrawingSvgExporter.Surface.cs#L44)

Converts a drawing to SVG with bounded cancellation and a safe generated-resource prefix.

Parameters

**drawing OfficeIMO.Drawing.OfficeDrawing required**

**scale double required**

**sizeUnit OfficeIMO.Drawing.OfficeSvgSizeUnit required**

**imageCodec OfficeIMO.Drawing.IOfficeRasterImageCodec? required**

**resourceIdPrefix string? required**

**cancellationToken System.Threading.CancellationToken required**

Returns

`string`

ToSvgBytes 6 overloads

`public static byte[] ToSvgBytes(OfficeDrawing drawing)` [#](#method-tosvgbytes-officeimo-drawing-officedrawing)

[OfficeDrawingSvgExporter.cs:34](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeDrawingSvgExporter.cs#L34)

Converts a drawing to UTF-8 SVG bytes.

Parameters

**drawing OfficeIMO.Drawing.OfficeDrawing required**

Drawing to export.

Returns

`byte[]` UTF-8 encoded SVG bytes.

`public static byte[] ToSvgBytes(OfficeDrawing drawing, double scale)` [#](#method-tosvgbytes-officeimo-drawing-officedrawing-double)

[OfficeDrawingSvgExporter.cs:42](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeDrawingSvgExporter.cs#L42)

Converts a drawing to UTF-8 SVG bytes with a scaled output surface.

Parameters

**drawing OfficeIMO.Drawing.OfficeDrawing required**

Drawing to export.

**scale double required**

Scale applied to the exported SVG width and height.

Returns

`byte[]` UTF-8 encoded SVG bytes.

`public static byte[] ToSvgBytes(OfficeDrawing drawing, double scale, OfficeSvgSizeUnit sizeUnit)` [#](#method-tosvgbytes-officeimo-drawing-officedrawing-double-officeimo-drawing-officesvgsizeunit)

[OfficeDrawingSvgExporter.Surface.cs:114](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeDrawingSvgExporter.Surface.cs#L114)

Converts a drawing to UTF-8 SVG bytes with an explicit root size unit.

Parameters

**drawing OfficeIMO.Drawing.OfficeDrawing required**

**scale double required**

**sizeUnit OfficeIMO.Drawing.OfficeSvgSizeUnit required**

Returns

`byte[]`

`public static byte[] ToSvgBytes(OfficeDrawing drawing, double scale, OfficeSvgSizeUnit sizeUnit, IOfficeRasterImageCodec? imageCodec)` [#](#method-tosvgbytes-officeimo-drawing-officedrawing-double-officeimo-drawing-officesvgsizeunit-officeimo-drawing-iofficerasterimagecodec)

[OfficeDrawingSvgExporter.Surface.cs:122](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeDrawingSvgExporter.Surface.cs#L122)

Converts a drawing to UTF-8 SVG bytes and uses an optional shared image codec.

Parameters

**drawing OfficeIMO.Drawing.OfficeDrawing required**

**scale double required**

**sizeUnit OfficeIMO.Drawing.OfficeSvgSizeUnit required**

**imageCodec OfficeIMO.Drawing.IOfficeRasterImageCodec? required**

Returns

`byte[]`

`public static byte[] ToSvgBytes(OfficeDrawing drawing, double scale, OfficeSvgSizeUnit sizeUnit, IOfficeRasterImageCodec? imageCodec, string? resourceIdPrefix)` [#](#method-tosvgbytes-officeimo-drawing-officedrawing-double-officeimo-drawing-officesvgsizeunit-officeimo-drawing-iofficerasterimagecodec-string)

[OfficeDrawingSvgExporter.Surface.cs:131](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeDrawingSvgExporter.Surface.cs#L131)

Converts a drawing to UTF-8 SVG bytes and prefixes generated resource identifiers for safe inline composition.

Parameters

**drawing OfficeIMO.Drawing.OfficeDrawing required**

**scale double required**

**sizeUnit OfficeIMO.Drawing.OfficeSvgSizeUnit required**

**imageCodec OfficeIMO.Drawing.IOfficeRasterImageCodec? required**

**resourceIdPrefix string? required**

Returns

`byte[]`

`public static byte[] ToSvgBytes(OfficeDrawing drawing, double scale, OfficeSvgSizeUnit sizeUnit, IOfficeRasterImageCodec? imageCodec, string? resourceIdPrefix, CancellationToken cancellationToken)` [#](#method-tosvgbytes-officeimo-drawing-officedrawing-double-officeimo-drawing-officesvgsizeunit-officeimo-drawing-iofficerasterimagecodec-string-threading-cancellationtoken)

[OfficeDrawingSvgExporter.Surface.cs:141](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeDrawingSvgExporter.Surface.cs#L141)

Converts a drawing to cancellable UTF-8 SVG bytes and prefixes generated resource identifiers.

Parameters

**drawing OfficeIMO.Drawing.OfficeDrawing required**

**scale double required**

**sizeUnit OfficeIMO.Drawing.OfficeSvgSizeUnit required**

**imageCodec OfficeIMO.Drawing.IOfficeRasterImageCodec? required**

**resourceIdPrefix string? required**

**cancellationToken System.Threading.CancellationToken required**

Returns

`byte[]`

## Inherited Methods

`public virtual bool Equals(object? obj)` [#](#method-equals-object)

Inherited from object

Parameters

**obj object? required**

Returns

`bool`

`public virtual int GetHashCode()` [#](#method-gethashcode)

Inherited from object

Returns

`int`

`public Type GetType()` [#](#method-gettype)

Inherited from object

Returns

`Type`

`public virtual string? ToString()` [#](#method-tostring)

Inherited from object

Returns

`string?`

<!-- PowerForge markdown artifact sha256:A5FB4F91369B75EDF4C27C7862C7878ECC3BC677AE52FEE1779B75D015990ACF -->
