#1
Posted
:
Friday, September 29, 2017 4:40:28 PM(UTC)
Groups: Registered
Posts: 119
Was thanked: 4 time(s) in 4 post(s)
When working with SVG files and the LEADTOOLS SDK, there are some methods within the SVG Document class that require flat SVGs to be used. To convert a non-flat document to a flat one, in-place, use the
SvgDocument.Flat method. This method accepts an
SvgFlatOptions parameter that can contain the final desired size of the document in pixels. If this parameter is omitted or the value of the size is 0, then SvgDocument will try calculating the final size automatically
Below you will find a code snippet on how you can use the
SvgFlatOptions ClassCode:
RasterCodecs codecs = new RasterCodecs();
using (SvgDocument doc = codecs.LoadSvg(svg, 24, null) as SvgDocument)
{
if (doc.IsFlat != true)
{
SvgFlatOptions options = new SvgFlatOptions();
//automatically calculate the size of the flattened SVG document
options.Size = LeadSizeD.Empty;
//flatten the document
doc.Flat(options);
}
Console.WriteLine("SVG is now a flat document");
//save SVG
doc.SaveToFile(dest, null);
Console.Write("DONE...");
}
Nick Villalobos
Developer Support Engineer
LEAD Technologies, Inc.
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.