How to convert and view SVG and SVGZ files

Introduction

SVG and SVGZ are Scalable Vector Graphics formats. SVG is a Flat Scalable Vector Graphics format in uncompressed XML. SVGZ consists of a GZIPped archive with one traditional SVG file.

These files can be opened with Adobe Illustrator, Corel PaintShop Pro, Serif DrawPlus, and Inkscape.

In case you need to view an SVG(SVGZ) file in a browser or in a standard image or PDF viewer application, you can convert it to HTML, JPEG, PNG PDF format with GroupDocs.Viewer for .NET.

Image in desktop program

How to convert SVG/SVGZ files

Convert SVG/SVGZ to HTML

To convert SVG/SVGZ files to HTML with GroupDocs.Viewer for .NET use following code:

using (Viewer viewer = new Viewer("sample.svgz"))
{
       HtmlViewOptions options = HtmlViewOptions.ForEmbeddedResources("output.html");

       viewer.View(options);
}

The following screenshot shows the output HTML file opened in a browser.

Result in browser

Convert SVG/SVGZ to JPG

To convert SVG/SVGZ files to JPG with GroupDocs.Viewer for .NET use following code:

using (Viewer viewer = new Viewer("sample.svgz"))
{
       JpgViewOptions options = new JpgViewOptions("output.jpg");

       viewer.View(options);
}

The following screenshot shows the output JPG file opened in a Windows Photo Viewer application.

Result in JPG

Convert SVG/SVGZ to PNG

To convert PLT/HPG files to PNG with GroupDocs.Viewer for .NET use following code:

using (Viewer viewer = new Viewer("sample.svgz"))
{
       PngViewOptions options = new PngViewOptions("output.png");

       viewer.View(options);
}

The following screenshot shows the output PNG file opened in a Windows Photo Viewer application.

Result in PNG

Convert SVG/SVGZ to PDF

To convert SVGZ files to PDF with GroupDocs.Viewer for .NET use following code:

using (Viewer viewer = new Viewer("sample.svgz"))
{
       PdfViewOptions options = new PdfViewOptions("output.pdf");

       viewer.View(options);
}

The following screenshot shows the output PDF file opened in an Acrobat Reader.

Result in PDF

More resources

GitHub Examples

You may easily run the code above and see the feature in action in our GitHub examples:

Free Online App

Along with full-featured .NET library we provide simple but powerful free Apps. You are welcome to view Word, PDF, Excel, PowerPoint documents with free to use online GroupDocs Viewer App.