Star - Discover Gists · GitHub

Skip to content All gists Back to GitHub Sign in Sign up Sign in Sign up Dismiss alert {{ message }}

Instantly share code, notes, and snippets.

@groupdocs-com-kb groupdocs-com-kb/How to Convert SVG to PNG using C#.cs Last active May 21, 2022 08:12 Show Gist options
  • Star () You must be signed in to star a gist
  • Fork () You must be signed in to fork a gist
  • Embed Clone this repository at <script src="https://gist.github.com/groupdocs-com-kb/c2e40e87f27c5cb392d4a92569a68578.js"></script>
  • Save groupdocs-com-kb/c2e40e87f27c5cb392d4a92569a68578 to your computer and use it in GitHub Desktop.
Code Revisions 2 Embed Clone this repository at <script src="https://gist.github.com/groupdocs-com-kb/c2e40e87f27c5cb392d4a92569a68578.js"></script> Save groupdocs-com-kb/c2e40e87f27c5cb392d4a92569a68578 to your computer and use it in GitHub Desktop. Download ZIP How to Convert SVG to PNG using C#. For more information, please follow link: https://kb.groupdocs.com/conversion/net/how-to-convert-svg-to-png-using-csharp/ Raw How to Convert SVG to PNG using C#.cs This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters Show hidden characters
using System;
using GroupDocs.Conversion.Options.Convert;
namespace ConvertSvgToPngUsingCSharp
{
class Program
{
public static void Main(string[] args) // Main function to convert SVG to PNG using C#
{
// Remove the watermark in output PNG by adding license
string licensePath = "GroupDocs.Conversion.lic";
GroupDocs.Conversion.License lic = new GroupDocs.Conversion.License();
lic.SetLicense(licensePath);
// Load the source SVG file for conversion to PNG
var converter = new GroupDocs.Conversion.Converter("sample.svg");
// Set the convert options for the output PNG
ImageConvertOptions convertOptions = new ImageConvertOptions { Format = GroupDocs.Conversion.FileTypes.ImageFileType.Png };
// Convert and save the SVG in PNG format
converter.Convert("converted.png", convertOptions);
Console.WriteLine("Done");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment You can’t perform that action at this time.

Từ khóa » Svg To Png C#