Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Friday, September 29, 2017 4:40:28 PM(UTC)
Nick Villalobos

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 Class

Code:

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.

LEAD Logo
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

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.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.029 seconds.