When saving EMF as SVG, the SVG Body dimensions are not correct


Sample.zip (1.3 KB)

I am using the following code to load the EMF file, and to save as SVG, as you can see I am correctly setting the dimensions of the page, but when you open the SVG file in an editor (or even open it in notepad) you can see it is exporting the incorrect dimensions.

Dim license = New Aspose.Imaging.License()

Dim image = Aspose.Imaging.Image.Load("input.emf")
Dim emfRasterizationOptions As New EmfRasterizationOptions()
emfRasterizationOptions.PageWidth = image.Width
emfRasterizationOptions.PageHeight = image.Height
emfRasterizationOptions.BackgroundColor = Aspose.Imaging.Color.Transparent
emfRasterizationOptions.CenterDrawing = True
Dim opt As New SvgOptions() With {.VectorRasterizationOptions = emfRasterizationOptions, .TextAsShapes = True}
image.Save("asposeoutput.svg", opt)

The exported SVG file has the following:
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="body_1" width="383" height="300">

As you can see it’s setting 383 for width and 300 as height, which I am not sure where it’s grabbing from. If I manually edit the SVG file in a text editor, and change the width and height to the correct dimensions (287 x 220) then the SVG file appears perfectly.

Has anyone else ever encounter this issue?

The original EMF input and Aspose.Imaging exported SVG files have been attached as a zip file.



I have observed issue shared by you. An issue with ID IMAGINGNET-3134 has been created in our issue tracking system to investigate and resolve the issue. This thread has been linked with these issues so that you may be automatically notified once the issues will be resolved.


Thanks, we are using a workaround, which involves manipulating the MemoryStream to manually fix the width and height attributes, which comes at a small performance hit. But please let us know once this is updated. Thanks again.



We will share feedback with you as soon as the issue will be fixed.