// This code is part of GrapeCity Documents for PDF samples.
// Copyright (c) GrapeCity, Inc. All rights reserved.
using System;
using System.IO;
using System.Drawing;
using System.Linq;
using System.Collections.Generic;
using GrapeCity.Documents.Pdf;
using GrapeCity.Documents.Text;
using GrapeCity.Documents.Svg;
using GCTEXT = GrapeCity.Documents.Text;
using GCDRAW = GrapeCity.Documents.Drawing;
using GcPdfWeb.Samples.Common;

namespace GcPdfWeb.Samples
    // This sample shows how to render an SVGZ (compressed SVG) image.
    // The SVG art used in this sample is from
    public class RenderSvgz
        public int CreatePDF(Stream stream)
            var svgPath = Path.Combine("Resources", "SvgMisc", "Smiling-Girl.svgz");
            using var svg = GcSvgDocument.FromSvgz(File.ReadAllBytes(svgPath));

            // Render the image and a border around it:
            var doc = new GcPdfDocument();
            var g = doc.NewPage().Graphics;
            var pt = new PointF(72, 72);
            g.DrawSvg(svg, pt);
            var sz = svg.GetIntrinsicSize(SvgLengthUnits.Points);
            g.DrawRectangle(new RectangleF(pt, sz), Color.MediumPurple);

            // Done:
            return doc.Pages.Count;