Developers can convert any Microsoft Visio document to PNG (Portable Network Graphics) in Java using Aspose.Diagram which is a light-weight, extensible, easy to use API and helps developers to create, manipulate and convert Microsoft Visio files to various formats on client side and server-side without any need to install Microsoft Visio or using any sort of Microsoft Office automation.
Sample Microsoft Visio Document - VSDX
For demonstration, we will convert the following sample Microsoft Visio document to PNG in Java using Aspose.Diagram for Java. However, you can use any Microsoft Visio document of your choice inside the sample code and it will also be converted to PNG fine.
Please note, if you will execute the code without prior setting the Aspose.Diagram license, you will get Evaluation Watermark in your output documents. For more information, please go through Licensing.
The following sample code converts the Microsoft Visio document to PNG by performing these steps.
- Load Microsoft Visio document to com.aspose.diagram.Diagram object.
- Specify ImageSaveOptions to set resolution for clear image.
- Save the com.aspose.diagram.Diagram object into PNG format with specified ImageSaveOptions.
Output PNG of Microsoft Visio Document by Aspose.Diagram
The following snapshot shows the Output PNG of Microsoft Visio Document generated by Aspose.Diagram with the code given above. As you can see, the PNG looks exactly same as Microsoft Visio document.