Convert Visio to EMF missing arrows and other inconsistencies

I’m evaluating your Aspose.Diagram tool for .NET. I’m finding issues on many of our drawings when exporting to and EMF…

  • Arrows are missing
  • Dotted line style changed
  • Lines drawn too long
  • Drawing not enlarged to fit

Here is a zip containing the original Visio file, the Aspose Diagram EMF file and Visio generated EMF file that shows the issues…

AsposeEMFIssue.zip (62.0 KB)

Here’s the method and save options I’m using…

        public static string AsposeExportToEmf(string filename, FillOptions fillOptions)
        {
            var toReturn = default(string);

            using (var diagram = new Diagram(filename))
            {
                if (diagram.Pages.Count > 0)
                {
                    var page = diagram.Pages[0];

                    ImageSaveOptions saveOptions = new ImageSaveOptions(SaveFileFormat.Emf)
                    {
                        PageIndex = 0,
                        Resolution = 300,
                        Scale = 1,
                        EnlargePage = true,
                    };

                    var tempPath = Path.Combine(@"C:\Emf\Aspose.Diagram", $"{Path.GetFileNameWithoutExtension(filename)}.emf");
                    diagram.Save(tempPath, saveOptions);

                    toReturn = tempPath;
                }
            }

            return toReturn;
        }

Thanks,

R. Troy

@bigelowt

It seems you are encountering several issues when exporting Visio drawings to EMF format using the Aspose.Diagram tool. Here are some potential solutions and considerations to address the problems you’ve listed:

  1. Missing Arrows: Ensure that the shapes in your Visio diagram are properly defined with their connectors. Sometimes, connectors may not be rendered correctly if they are not linked properly to the shapes. You might want to check the properties of the connectors in your Visio file.

  2. Dotted Line Style Changed: The rendering of line styles can vary between Visio and the EMF format. You can try adjusting the SmoothingMode or InterpolationMode properties in the ImageSaveOptions to see if that helps maintain the visual fidelity of the dotted lines.

  3. Lines Drawn Too Long: This issue may arise from how the shapes are defined in the Visio file. Make sure that the dimensions and positions of the shapes are set correctly. Additionally, you can explore the Scale property in the ImageSaveOptions to adjust the rendering size.

  4. Drawing Not Enlarged to Fit: You have set the EnlargePage property to true, which should ideally enlarge the page to fit the content. If this is not working as expected, consider checking the PageSize property to ensure it is set correctly. You might also want to experiment with the Area property to define the specific area of the diagram to be rendered.

Here is a revised version of your method with some additional properties you might consider adjusting:

public static string AsposeExportToEmf(string filename, FillOptions fillOptions)
{
    var toReturn = default(string);

    using (var diagram = new Diagram(filename))
    {
        if (diagram.Pages.Count > 0)
        {
            var page = diagram.Pages[0];

            ImageSaveOptions saveOptions = new ImageSaveOptions(SaveFileFormat.Emf)
            {
                PageIndex = 0,
                Resolution = 300,
                Scale = 1,
                EnlargePage = true,
                SmoothingMode = SmoothingMode.AntiAlias, // Adjust for better line rendering
                InterpolationMode = InterpolationMode.HighQualityBicubic // Improve scaling quality
            };

            var tempPath = Path.Combine(@"C:\Emf\Aspose.Diagram", $"{Path.GetFileNameWithoutExtension(filename)}.emf");
            diagram.Save(tempPath, saveOptions);

            toReturn = tempPath;
        }
    }

    return toReturn;
}

If these adjustments do not resolve the issues, consider reaching out to Aspose support with the specific files you are working with, as they may be able to provide more tailored assistance based on the content of your Visio files.

For further details on the properties available in ImageSaveOptions, you can refer to the official documentation here.

If you continue to experience problems, please provide more context or specific examples, and I would be happy to assist further!

@bigelowt
Thanks for the template file and output files.
After an initial testing, I am able to reproduce the issue as you mentioned by using your template file.

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): DIAGRAMNET-53772

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

Thanks Philip, Cheers!

@bigelowt
Welcome!
Please feel free to contact us in case you have further comments or questions.

The issues you have found earlier (filed as DIAGRAMNET-53772) have been fixed in this update. This message was posted using Bugs notification tool by philip.zhou