GrapeCity Documents for Imaging v5.1 - April 22, 2022

GrapeCity Documents (GcDocs) is excited to announce the new v5.1 release!

Updates included in this release:

Save documents to SVG

Compared to raster image formats such as JPEG and PNG, SVG is a vector format that can be rendered at any size without loss of quality. This format gives designers and developers a lot of control over the image appearance. It is also a standardized format for web graphics, designed to work with other web conventions like HTML, CSS, JavaScript, and the Document Object Model. Due to the many advantages of SVG, it is essential to use SVG images in documents, such as PDF and images.

Read the release blog for full details.

GcImaging v5 - Decembeer 14, 2021

GrapeCity Documents for Imaging (GcImaging)

SVG Support

Compared to classic bitmapped image formats such as JPEG, PNG, SVG-format vector images can be rendered at any size without loss of quality. This format gives designers and developers a lot of control over the image appearance.

It is also a standardized format for web graphics, designed to work with other web conventions like HTML, CSS, JavaScript, and theDocument Object Model. Due to the many advantages of SVG, it is essential to use SVG images in documents, such as PDF and images.

With the v5 release, we introduce a new GcSvgDocument class that can create, load, inspect, and modify the internal structure of an SVG image. You can also obtain an Image from a File or stream, or byte array and draw the SVG image to the GcPdfDocument, GcBitmap, or GcWicBitmap classes using the GcGraphics.DrawSvg method.

All SVG features (including access to SVG DOM) are fully available in both GcPdf and GcImaging.

The code below draws svg files from a folder to a rectangle grid defined in PDF document.

// Render all images within the grid, adding new pages as needed:
            var g = doc.NewPage().Graphics;
            for (int i = 0; i < images.Count(); ++i)
            {
                    var rect = new RectangleF(ip, new SizeF(sWidth - gapx, sHeight - gapy));
                    g.FillRectangle(rect, Color.LightGray);
                    g.DrawRectangle(rect, Color.Black, 0.5f);
                    rect.Inflate(-sMargin, -sMargin);
            
                    var svg = images[i].Item2;
                    var s = svg.GetSize(SvgLengthUnits.Points);
                    if (s.Width > 0 && s.Height > 0)
                    {
                        // If image proportions are different from our target rectangle,
                        // we resize the rectangle centering the image in it:
                        var qSrc = s.Width / s.Height;
                        var qTgt = rect.Width / rect.Height;
                        if (qSrc < qTgt)
                        rect.Inflate(rect.Width * (qSrc / qTgt - 1) / 2, 0);
                        else if (qSrc > qTgt)
                        rect.Inflate(0, rect.Height * (qTgt / qSrc - 1) / 2);
                     }
                     // Render the SVG:
                     g.DrawSvg(images[i].Item2, rect);
            }
            

pdf

You can also perform additional operations with SVG images. Check out full demos in the sample browser.

Create SVG Images and Render to PDF Documents

Create a full SVG image and render it to a PDF document. Check out this demo that creates SVG images with geometrical shapes and renders them to a PDF document.

pdf

Access the SVG DOM

The GcSvgDocument class provides full access to the SVG Document Object Model. The following elements are currently supported: svg, g, defs, style, use, symbol, image, path, circle, ellipse, line, polygon, polyline, rect, clipPath, linearGradient, stop, title, metadata, desc, and more. Find more information below:

GcPDF Help | GcImaging Help | GcPdf Demo | GcImaging Demo

Check out the release notes for GcPdf and GcImaging.

Read the release blog for full details.