Unable to open EMF file in Aspose Image view online and MS Paint

Hi Team,

We have obtained a temporary license for Aspose.Imaging for Python via .NET to evaluate the library for the use case mentioned below.

Use Case:
We are trying to convert SVG files to EMF using the code below along with the license. While the EMF file is generated successfully, we are unable to open it using the Aspose image viewer (Free Online Image Viewer - View & Print Images | Image Viewer App) or MS Paint.

Version used:
Python: 3.9
.Net: 8.0

 var license = new Aspose.Imaging.License();
        license.SetLicense("Aspose.ImagingforPythonvia.NET.lic");

        using (var image = (Aspose.Imaging.FileFormats.Svg.SvgImage)Image.Load(inputPath))
        {
            var options = new EmfOptions
            {
                VectorRasterizationOptions = new SvgRasterizationOptions
                {
                    PageWidth = image.Width,
                    PageHeight = image.Height
                }
            };
            image.Save(outputPath, options);
        }

        Console.WriteLine("SVG converted to EMF successfully!");

@pradeep_gupta

It seems that you are encountering issues opening the EMF file generated from SVG using Aspose.Imaging. Here are a few suggestions to troubleshoot and potentially resolve the problem:

  1. Check EMF File Integrity: Ensure that the EMF file is being generated correctly. You can do this by checking the file size and attempting to open it with other applications that support EMF files, such as Adobe Illustrator or Inkscape.

  2. Review the Code: Your code for converting SVG to EMF looks correct, but ensure that the input SVG file is valid and not corrupted. You might want to test with different SVG files to see if the issue persists.

  3. Adjust Rasterization Options: The rasterization options you are using might need adjustments. For instance, you can try setting the PageSize directly instead of using PageWidth and PageHeight separately. Here’s a modified version of your code snippet:

    var options = new EmfOptions
    {
        VectorRasterizationOptions = new SvgRasterizationOptions
        {
            PageSize = new SizeF(image.Width, image.Height) // Set PageSize directly
        }
    };
    
  4. Update Aspose.Imaging: Ensure that you are using the latest version of Aspose.Imaging for Python via .NET. Sometimes, issues are resolved in newer releases, so updating might help.

  5. Test with Aspose Viewer: If the EMF file opens in other applications but not in the Aspose image viewer, it could be a limitation or a bug in the viewer itself. You might want to report this issue to Aspose support for further assistance.

If these suggestions do not resolve the issue, consider reaching out to Aspose support with details about the SVG files you are using and the specific errors encountered when trying to open the EMF file.

Sources:
[1]: SVGToEMFConversion.cs
[2]: SVGToEMFConversion.java

@pradeep_gupta Hello! Thank you for your interest in our product. We will investigate this issue and get back to you with the results soon. To help us test more accurately, could you please provide the SVG file where you’re experiencing this problem, and used Aspose.Imaging version?