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.
@philip.zhou
Could you please check whether this is solvable in Aspose.Diagram Old version 21.1.0.0?
Thanks
@msindia
I have tested your scenario/case using our old version : Aspose.Diagram for .net v21.1 .When using this quite older version, there is this issue when converting to PNG.
Also I have tested your scenario/case using our latest version : Aspose.Diagram for .net v25.5 . It works fine and as expected.
As you can see it works fine with latest version and we could not find any issue, so kindly use latest version. If you still find the issue with latest version, then please give more details and sample code to reproduce the issue. We will check your issue soon.
Thanks.
@philip.zhou ,
Thank you for your continued support.
Unfortunately, we are currently unable to upgrade to the latest version of Aspose.Diagram for .NET v25.5 due to internal compatibility constraints and existing production dependencies.
We are presently using Aspose.Diagram v21.1.0.0. If a workaround or patch is possible for this version, we would greatly appreciate it. We understand that this version is older, but due to current architectural constraints, upgrading is not feasible in the immediate term.
Thank you for your understanding and support.
Best Regards,
MSIndia
@msindia
We are sorry that we cannot fix the problem based on the very older version.
Neither we can include fixes to older version /APIs set.
The fixes are based on latest version/APIs set only.
Thank you for your patience and understanding.
@philip.zhou ,
Thanks for your information
@msindia
We are sorry for the inconvenience.
Please feel free to contact us in case you have further comments or questions.