Free Support Forum - aspose.com

Basic sample code for loading visio file in Java code

Is it necessary to write code in Maven Project?
Can I work in simple java project created in eclipse IDE for read & write MS visio file?
Can you please share sample code?

@sayli

You can surely use the API in Eclipse IDE and use the same code as shared in the API documentation. You can please download the JAR file from the below link and add it as external JAR into your Eclipse project. In case you face any issue, please feel free to let us know.

I have downloaded JAR files and loaded in eclipse.
I have also installed licensed 30 days evaluation of APIs.
Still when I try to save file in PDF format it does not work.
Saved pdf file is completely blank.

@sayli

Would you please share your sample VSDX file and generated PDF file for our reference. We will test the scenario in our environment and address it accordingly.

Test_block diagram.zip (9.8 KB)

This file just have one block.

Exported PDF file is completely blank.

@sayli

Would you please make sure to use the below code snippet for conversion as we used it with Aspose.Diagram for Java 21.2 and did not notice any issue:

try {
 com.aspose.diagram.SaveOptions so = new com.aspose.diagram.PdfSaveOptions();
 com.aspose.diagram.Diagram diagram = new com.aspose.diagram.Diagram(dataDir + "Test_block diagram.vsdx");
 diagram.save(dataDir + "Test_block diagram.pdf", so);
} catch (Exception e) {
 e.printStackTrace();
}

Test_block diagram.pdf (21.2 KB)