I am looking for a c# extension or nuget package to convert an SVG to PNG file with high picture quality.
-
I have edited out the off-topic coding question. You could place that on Stack Overflow, but not in its current form: it needs data (pictuires)– user416Commented Jun 27, 2019 at 6:24
-
1Maybe like this: stackoverflow.com/a/35524206/480982– Thomas WellerCommented Jun 27, 2019 at 9:04
-
OP is not asking how to write the code using that package/library, but for the package/library itself. So on-topic IMHO.– einpoklumCommented Aug 17, 2021 at 6:47
Add a comment
|
1 Answer
Consider using the DocumentConverter class from the Leadtools.Document.Sdk Nuget Package. You can use this class to take in your SVG as an input file and convert it to a number of supported Image and document formats, including PNG. (Disclaimer: I am an employee of this package’s vendor).
The C# code to use this would look like the following:
using (DocumentConverter documentConverter = new DocumentConverter())
{
var format = RasterImageFormat.Png;
var jobData = DocumentConverterJobs.CreateJobData(inFile, outFile, format);
jobData.JobName = "SVG to PNG job";
var job = documentConverter.Jobs.CreateJob(jobData);
documentConverter.Jobs.RunJob(job);
}