使用Aspose.SVG.dll转换svg为png图片,转换代码如下所示
using (var document = new SVGDocument(svgimage.FullName))
{
var pngSaveOptions = new ImageSaveOptions();
pngSaveOptions.Format = Aspose.Svg.Rendering.Image.ImageFormat.Png;
pngSaveOptions.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
pngSaveOptions.PageSetup.AnyPage = new Aspose.Svg.Drawing.Page(new Aspose.Svg.Drawing.Size(MAXSIZE, MAXSIZE));
pngSaveOptions.PageSetup.Sizing = Aspose.Svg.Rendering.SizingType.FitContent;
// Convert SVG to PNG
Converter.ConvertSVG(document, pngSaveOptions, outpath+bmpfile);
}
针对附件的svg文件,转换后效果和试用浏览器查看的效果不一样,看了下有些元素解析不太对,效果异常。下面是附件问题附件.zip (65.1 KB)