Hello I’m trying to convert a simple EMF to SVG but I’m getting this exception
Aspose.Imaging.CoreExceptions.ImageSaveException
HResult=0x80131500
Message=Image saving failed.
Source=Aspose.Imaging
StackTrace:
at Aspose.Imaging.Image.Save(String filePath, ImageOptionsBase options, Rectangle boundsRectangle)
at Aspose.Imaging.Image.Save(String filePath, ImageOptionsBase options)
at ReportUtils.ReportExporter.Export() in
...ReportExporter.cs:line 39
at BrowserControl.PlanFinishingBrowserControl.ExportReport() in ....cs:line 56
at BrowserControl.PlanFinishingBrowserControl.<.ctor>b__3_1(Object <p0>, LoadFinishedEventArgs <p1>) in ....cs:line 48
at System.EventHandler`1.Invoke(Object sender, TEventArgs e)
at DotNetBrowser.Navigation.NavigationControllerRpcService.<WhenLoadFinished>b__115_0()
at System.Threading.Tasks.Task.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
This exception was originally thrown at this call stack:
[External Code]
Inner Exception 1:
ImageSaveException: Image export failed.
Inner Exception 2:
NullReferenceException: Object reference not set to an instance of an object.
Here is the code snippet I’m using:
using (var image = Image.Load("C:\\Users\\fernando.lopez\\Desktop\\Report3.emf"))
{
// Initilaize EmfRasterizationOptions class object
var emfRasterizationOptions = new EmfRasterizationOptions();
// emfRasterizationOptions.BackgroundColor = Color.White;
emfRasterizationOptions.PageWidth = image.Width;
emfRasterizationOptions.PageHeight = image.Height;
// Save output SVG image
image.Save("C:\\Users\\fernando.lopez\\Desktop\\SimpleReport.svg", new SvgOptions() {VectorRasterizationOptions = emfRasterizationOptions, TextAsShapes = true});
}
And here the EMF file SimpleReport.zip (1.8 KB)
I would really appreciate your help, after this POC we will purchase the Imagin license