Hi Aspose,
We have a Viso file with external node shapes. We tried to export the Visio to PNG. The output is not as expected.
Visio File: ExternalNode.zip (37.7 KB)
Output PNG: ExportToImage_out.png (5.1 KB)
Here is the Difference:
VisioandPNG diff.png (73.9 KB)
Code:
[TestMethod]
public void TestVisioToPNG()
{
Diagram diagram = new Diagram("C:\\Temp\\VIsio Issue\\ExternalNode.vsdx");
// Save Image file
diagram.Save("C:\\Temp\\VIsio Issue\\" + "ExportToImage_out.png", SaveFileFormat.PNG);
}
Could you please help us to resolve this issue
Thanks & Regards,
MS india
@msindia
It seems that you are experiencing issues with exporting a Visio file to PNG format, particularly with external node shapes not rendering as expected. Here are a few suggestions to help you troubleshoot and potentially resolve the issue:
-
Check the Export Options: When saving the diagram as an image, you can specify additional options that might affect the output. For instance, you can use ImageSaveOptions
to set parameters like the page index or resolution. Here’s an example of how to implement this:
using Aspose.Diagram;
using Aspose.Diagram.Saving;
public void ExportVisioToPNG(string inputFilePath, string outputFilePath)
{
// Load the diagram
Diagram diagram = new Diagram(inputFilePath);
// Create image save options
ImageSaveOptions options = new ImageSaveOptions(SaveFileFormat.PNG);
options.PageIndex = 0; // Specify the page index if needed
// Save the diagram as PNG
diagram.Save(outputFilePath, options);
}
-
Verify the VSDX File: Ensure that the VSDX file is not corrupted and that it opens correctly in Microsoft Visio. Sometimes, issues with the original file can lead to unexpected results during export.
-
Update Aspose.Diagram Library: Make sure you are using the latest version of the Aspose.Diagram library. Updates often include bug fixes and improvements that could resolve your issue.
-
Test with Different Files: If possible, try exporting a different Visio file to see if the problem persists. This can help determine if the issue is specific to the file you are currently using.
-
Review Documentation and Examples: You can refer to the official documentation and examples provided by Aspose for additional guidance on exporting diagrams. This can provide insights into best practices and common pitfalls.
If the issue continues after trying these suggestions, consider reaching out to Aspose support with detailed information about your problem, including the specific version of the library you are using and any error messages you may encounter.
Feel free to ask if you need further assistance!
Sources:
[1]: Export to Image Example
@msindia
Thanks for the template file and screenshots.
I have tested your scenario/case using our latest version : Aspose.Diagram for .net v25.3 . It works fine and as expected.
Please check the ouptput png of the latest version.
ExternalNodeOutput.png (2.7 KB)
As you can see it works fine with latest version and we could not find any issue, so please kindly use latest version Aspose.Diagram for .net v25.3 .
Thanks.
1 Like
Thanks for your information.
We have checked this with latest version the image issue is resolved now.
Thanks a lot 
@msindia
Thanks for following the suggested workaround and good know that your issue is sorted out now.
Please feel free to contact us in case you have further comments or questions.