//// This code is part of Document Solutions for PDF .NET demos.// Copyright (c) MESCIUS inc. All rights reserved.//usingSystem;usingSystem.IO;usingSystem.Drawing;usingSystem.Linq;usingSystem.Collections.Generic;usingGrapeCity.Documents.Pdf;usingGrapeCity.Documents.Svg;usingGCTEXT = GrapeCity.Documents.Text;usingGCDRAW = GrapeCity.Documents.Drawing;usingDsPdfWeb.Demos.Common; namespaceDsPdfWeb.Demos{// Use GcSvgDocument to render a few images used as illustrations // in the SVG spec.publicclassSvgSpecArt {publicintCreatePDF(Stream stream) {// Load images from resources:var fnames = newList<string>() { "dash-path.svg", "opacity.svg", "paths.svg", "shadowstyle.svg", "units.svg", };var images = newList<(string, GcSvgDocument)>();foreach (var f in fnames) images.Add((f, GcSvgDocument.FromFile(Path.Combine("Resources", "SvgSpecArt", f)))); constfloatmargin = 36;constfloatgapy = 18;var ip = newPointF(margin, margin); // Render the images:var doc = newGcPdfDocument();var g = doc.NewPage().Graphics;for (int i = 0; i < images.Count(); ++i) {var svg = images[i].Item2;var s = svg.GetIntrinsicSize(SvgLengthUnits.Points); g.DrawSvg(svg, ip); ip.Y += s.Height + gapy; }// Done: doc.Save(stream);// Dispose images after saving the PDF: images.ForEach(t_ => t_.Item2.Dispose());return doc.Pages.Count; } }}