Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
Use the SVG Converter guides when your source is an SVG file, SVG string, stream, or URL. Aspose.HTML for .NET converts SVG to PDF, XPS, DOCX, JPG, PNG, BMP, TIFF, and GIF in C#.
SVG is a text-based vector format, so it is commonly converted when an application needs printable PDF output, raster previews, thumbnails, document reports, or Word-compatible results. In Aspose.HTML for .NET, SVG conversion usually uses SVGDocument with Converter.ConvertSVG() and target-specific save options. The complete C# example project is available in the Aspose.HTML for .NET GitHub repository.
PdfSaveOptions, ImageSaveOptions, DocSaveOptions, or XpsSaveOptions.Converter.ConvertSVG() and pass the SVG source, options, and output path.The following example converts SVG to PNG with custom ImageSaveOptions.
1// Convert SVG to PNG in C# with custom settings
2
3// Prepare a path to a source SVG file
4string documentPath = Path.Combine(DataDir, "flower1.svg");
5
6// Prepare a path to save the converted file
7string savePath = Path.Combine(OutputDir, "flower-options.png");
8
9// Initialize an SVG document from the file
10using SVGDocument document = new SVGDocument(documentPath);
11
12// Create an instance of the ImageSaveOptions class. Set up the SmoothingMode, resolutions, and change the background color to AliceBlue
13ImageSaveOptions options = new ImageSaveOptions()
14{
15 HorizontalResolution = 200,
16 VerticalResolution = 200,
17 BackgroundColor = System.Drawing.Color.AliceBlue,
18 UseAntialiasing = true,
19};
20
21// Convert SVG to PNG
22Converter.ConvertSVG(document, options, savePath);SVG to documents
SVG to image formats
Use the online SVG Converter for quick manual conversion. Use Aspose.HTML for .NET when SVG conversion must run inside a C# application.
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.