Aspose.SVG for .NET is a flexible library for SVG file processing and is fully compatible with its specifications. API can easily load, save and convert SVG files as well as read and traverse the elements of files through its Document Object Model (DOM). API is independent of any other software and empowers developers to work with SVG files without going into the underlying details of the format.
Advanced Features of Aspose.SVG for .NET API
new Edit SVG files
Navigate SVG using XPath Query
Navigate via CSS Selectors, Element and Document Traversal
Useful Documentation Links for C# Library Functions
- Create or load SVG documents from a file, URL, string, stream, etc.
- Convert SVG to PDF, PNG, and other popular formats.
- Vectorize raster images such as PNG, JPG, BMP, TIFF, GIF, and ICO into an SVG document.
- Navigate SVG documents using XPath Query, CSS Selector, Element and Document Traversal features.
- Edit SVG files by inserting new nodes, removing, or editing the content of existing nodes.
- Render SVG documents with high quality.
- Vectorize SVG text in a short time and with professional quality and resolution, and more.
Convert SVG using C#
Aspose.SVG for .NET can read and convert SVG to PDF, XPS and major image formats. The conversion process is simple and reliable, thus making SVG .NET API a perfect choice. You can use API in your C# or any other .NET application to develop converter applications without getting into the details of underlying file formats. Getting conversion functionality is simple and depends on each application requirement. Here are a few lines of code for conversion between formats.
Convert SVG to PNG – C#
using Aspose.Svg;
using Aspose.Svg.Saving;
using Aspose.Svg.Converters;
...
// Initialize an SVG document from a file
using (SVGDocument document = new SVGDocument("input.svg"))
{
// Create an instance of the ImageSaveOptions class
ImageSaveOptions pngSaveOptions = new ImageSaveOptions();
// Convert SVG to PNG
Converter.ConvertSVG(document, pngSaveOptions, "output.png");
}
You can try online SVG Converter by following the link.
Other Supported SVG Conversions:
Convert Raster Image to Vector Graphic
Converting an image to vector is very easy using Aspose.SVG API. The ImageVectorization Namespace includes classes and interfaces for implementing the image vectorization process. The following code snippet demonstrates the use of the ImageVectorizer class for image vectorization:
Convert Image to Vector – C#
using Aspose.Svg.ImageVectorization;
using Aspose.Svg.Saving;
...
// Initialize an instance of the ImageVectorizer class
ImageVectorizer vectorizer = new ImageVectorizer
{
// Optionally set a configuration
Configuration =
{
// Optionally create an instance of the PathBuilder class
PathBuilder = new SplinePathBuilder
{
TraceSmoother = new ImageTraceSmoother(1),
TraceSimplifier = new ImageTraceSimplifier(0.3f)
},
ColorsLimit = 25,
LineWidth = 1
}
};
// Vectorize image from a specified file
using (SVGDocument document = vectorizer.Vectorize(Path.Combine(DataDir, "horses.jpg")))
{
// Save the vectorized image as SVG
document.Save(Path.Combine(OutputDir, "horses-new.svg"));
}
You can try free online Image Vectorizer.
Other Supported Vectorizers:
Merge SVG in C#
The Renderer() method gives you the ability to send multiple documents at once to the output rendering device and merge them. Documents merging can be done with a few lines of code:
Merge SVG to PDF – C#
using Aspose.Svg;
using Aspose.Svg.Rendering;
using Aspose.Svg.Rendering.Pdf;
...
// Initialize SVG documents from files to merge later
using (SVGDocument document1 = new SVGDocument("input1.svg"))
using (SVGDocument document2 = new SVGDocument("input2.svg"))
using (SVGDocument document3 = new SVGDocument("input3.svg"))
{
// Create an instance of SvgRenderer
using (SvgRenderer renderer = new SvgRenderer())
{
// Create an instance of PdfDevice
using (PdfDevice device = new PdfDevice("output.pdf"))
{
// Merge all SVG documents into a single PDF file
renderer.Render(device, document1, document2, document3);
}
}
}
Other Supported Mergers:
Why Choose Aspose.SVG for .NET?
Aspose.SVG for .NET is designed to provide a complete and reliable solution for working with SVG files across a wide range of applications and environments.
No External Dependencies Aspose.SVG for .NET is a self-contained library. You do not need to install additional software or configure system dependencies. This eliminates compatibility issues and reduces deployment complexity.
High-Performance Rendering The API uses optimized rendering engine designed for speed and accuracy. It processes large SVG files efficiently and produces pixel-perfect output in target formats. The rendering engine handles complex SVG features including filters, gradients, masks, and CSS3 styles with full W3C specification compliance.
Enterprise-Ready Architecture Designed for server-side SVG processing, the API can be integrated into backend applications and services built with .NET. It supports cross-platform deployment on Linux, Windows, and macOS, and can be used in containerized environments such as Docker.
Comprehensive SVG Support Full support for SVG 1.1 and parts of SVG 2.0 specifications including DOM manipulation, XPath queries, CSS selectors, and programmatic document creation. The API provides complete control over SVG elements, attributes, and styles through the Document Object Model.
Developer-Friendly API Intuitive C# API with clear method names and well-documented classes. The library follows .NET conventions and integrates seamlessly with Visual Studio. Comprehensive documentation, code examples, and free technical support are available to help you get started quickly.
Reliable and Supported Regular updates with bug fixes and new features. Enterprise-grade support options available for production environments. The API is used by thousands of developers and companies worldwide for critical business applications.
Support and Learning Resources
- Learning Resources
- Documentation
- Source Code
- API References
- Product Support
- Free Support
- Paid Support
- Blog
- Release Notes
- Why Aspose.SVG for .NET?
- Customers List
- Success Stories