public class SvgFlatOptions Used by the SvgDocument.Flat and SvgDocument.ToFlat methods to set the options used when converting an SVG document to flat. For more information about flat SVG documents and bounds and resolution, refer to SVG Size, Bounds and Flat.
using Leadtools;using Leadtools.Codecs;using Leadtools.Drawing;using Leadtools.Forms.DocumentWriters;using Leadtools.Svg;using Leadtools.Document.Writer;public void SvgDocumentExample(){// input directorystring inDir = LEAD_VARS.ImagesDir;// output directorystring outDir = Path.Combine(LEAD_VARS.ImagesDir, "svgpages");if (!Directory.Exists(outDir))Directory.CreateDirectory(outDir);using (var codecs = new RasterCodecs()){// Set 300 as the default value for loading document filescodecs.Options.RasterizeDocument.Load.Resolution = 300;codecs.ThrowExceptionsOnInvalidImages = false;// Get all the files from input directoryforeach (var srcFileName in Directory.EnumerateFiles(inDir)){Console.WriteLine("Checking {0}", srcFileName);using (var info = codecs.GetInformation(srcFileName, false)){// We can load as SVG if its document or vector (skipping SVG files themselves)if (info.Format != RasterImageFormat.Unknown && // valid formatinfo.Format != RasterImageFormat.Svg && // not svg(info.Document.IsDocumentFile || // a documentinfo.Vector.IsVectorFile)) // or vector{// try to load the first page as SVGtry{using (SvgDocument svgDocument = codecs.LoadSvg(srcFileName, 1, null) as SvgDocument){// Save it to diskstring name = Path.GetFileName(srcFileName).Replace(".", "-");name = Path.ChangeExtension(name, "svg");string dstFileName = Path.Combine(outDir, name);Console.WriteLine("Saving to {0}", dstFileName);svgDocument.SaveToFile(dstFileName, null);}}catch (Exception ex){Console.WriteLine(ex.Message);}}}}}}static class LEAD_VARS{public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images";}