Class SvgSaveOptions
How Save(Stream, SvgSaveOptions?) writes a document.
public sealed record SvgSaveOptions : IEquatable<SvgSaveOptions>
- Inheritance
-
SvgSaveOptions
- Implements
- Inherited Members
Examples
// Numbers and paths set in code are written with Precision decimals; what was read keeps its text.
document.FindById("body")!.Attributes.Set("width", 17.666666);
document.Save(path, new SvgSaveOptions { Precision = 2, Gzip = true });
using var stream = new MemoryStream();
document.Save(stream);
Properties
Default
Gets the defaults: indented, three decimals, not gzipped.
public static SvgSaveOptions Default { get; }
Property Value
Gzip
Gets a value indicating whether to write gzip data, an .svgz file. Defaults to false.
public bool Gzip { get; init; }
Property Value
Indent
Gets a value indicating whether elements made in code are written on their own indented lines. Content read from a file keeps its own whitespace either way. Defaults to true.
public bool Indent { get; init; }
Property Value
Precision
Gets the number of decimals written for numbers and paths set in code (through Set(string, double, string?, string?) and SetPath(string, Path)), from 0 to 9; trailing zeros are left out. Text attributes are written as they are. Defaults to 3.
public int Precision { get; init; }
Property Value
Exceptions
- ArgumentOutOfRangeException
The value is below 0 or above 9.