This gist collection contains C# examples from the How to Convert SVG Files section of the Aspose.SVG for .NET documentation. Learn how to convert SVG documents to PDF, XPS, PNG, JPG, BMP, TIFF, GIF, and SVGZ, resize SVG output during rendering, and convert raster images to vector SVG.
- Convert SVG to PDF and XPS – Convert SVG files to fixed-layout document formats with custom page settings.
- Convert SVG to image formats – Export SVG to PNG, JPG, BMP, TIFF, and GIF with custom rendering options.
- Use
Converter.ConvertSVG()– Convert SVG documents with save options in a concise API call. - Use
SVGDocument.RenderTo()– Render SVG documents through PDF, XPS, and image devices for greater control. - Resize SVG output – Fit, scale, contain, or crop SVG content during conversion.
- Convert image to SVG – Convert raster images and image streams to vector SVG using
ConvertImageToSVG(). - Various conversion scenarios – Convert SVG from different sources (file, URL, string, stream) using default or custom save/render options.
Aspose.SVG for .NET is a powerful, on-premise library designed to create, manipulate, and convert SVG files. Its conversion API supports PDF, XPS, raster image formats, SVGZ, and image-to-SVG vectorization scenarios. The library helps developers control output format, page setup, rendering quality, background color, resolution, and sizing behavior programmatically.
Each gist is a self-contained, executable example designed to help you quickly integrate SVG conversion functionalities into your .NET applications.
- Add Aspose.SVG for .NET Dependency – Ensure your .NET project has a reference to the Aspose.SVG for .NET library. You can easily install it via NuGet.
- Select an Example – Browse through the gists and choose the one that matches the conversion task you need to perform.
- Copy the Code – Copy the C# code directly from the selected gist.
- Execute – Paste the code into your project and run it to observe the powerful conversion capabilities.
You can download a free trial of Aspose.SVG for .NET and use a temporary license for unrestricted access.
- .NET Platforms: .NET Framework 4.6.1+, .NET Core 2.0+, or .NET 5+.
- Supported OS: Windows, Linux, macOS.
- Development environment such as Visual Studio.
- Aspose.SVG for .NET installed via NuGet.