//// This code is part of Document Solutions for PDF .NET demos.// Copyright (c) MESCIUS inc. All rights reserved.//usingSystem.IO;usingSystem.Drawing;usingGrapeCity.Documents.Pdf;usingGrapeCity.Documents.Svg;usingGCTEXT = GrapeCity.Documents.Text;usingGCDRAW = GrapeCity.Documents.Drawing;usingDsPdfWeb.Demos.Common; namespaceDsPdfWeb.Demos{// This short sample shows how to measure and render an SVG image.// Note that when an SVG is rendered on GcPdfGraphics, it is NOT rasterized,// so the image quality is preserved if the SVG is scaled up or down.// // The SVG art used in this sample is from freesvg.org.publicclassRenderSvg {publicintCreatePDF(Stream stream) {// Load the SVG:var svgPath = Path.Combine("Resources", "SvgClipArt", "Smiling-Girl.svg");usingvar svg = GcSvgDocument.FromFile(svgPath); // Measure and render the image:var doc = newGcPdfDocument();var g = doc.NewPage().Graphics;var pt = newPointF(g.Resolution, g.Resolution);var rc = newRectangleF(pt, svg.GetIntrinsicSize(SvgLengthUnits.Points));// Draw the SVG and a border around it: g.DrawSvg(svg, pt); g.DrawRectangle(rc, Color.DarkGray); // Done: doc.Save(stream);return doc.Pages.Count; } }}