Microsoft Visio drawings are commonly used to create diagrams. In certain situations, you may need to convert a Visio Diagram file in VSD, VSDX format to a JPG, PNG, or TIFF image using Java. This article covers different conversion scenarios under the following headings:
- Visio Drawing to Image Converter – Java API Installation
- Convert Visio (VSD/VSDX) File to JPG, PNG, or TIFF Image Programmatically using Java
- Convert a Specific Page of Visio VSD/VSDX to Image using Java
Visio Drawing to Image Converter – Java API Installation
Aspose.Diagram for Java API supports working with VSD/VSDX and several other file formats. You can install the API by downloading its JAR file from the Downloads section, or using the following Maven specifications:
Repository:
<repositories>
<repository>
<id>AsposeJavaAPI</id>
<name>Aspose Java API</name>
<url>http://repository.aspose.com/repo/</url>
</repository>
</repositories>
Dependency:
<dependencies>
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-diagram</artifactId>
<version>21.11</version>
<classifier>jdk16</classifier>
</dependency>
</dependencies>
Convert Visio VSD/VSDX File to JPG, PNG, or TIFF Image Programmatically using Java
You can convert a Visio drawing to a JPG, PNG, or other image formats with the steps below:
- Load the input VSD/VSDX file with the Diagram class.
- Save output JPG, SVG, BMP, GIF, or SVG Image file using the Save method.
The following code snippet explains how to convert a VSD/VSDX diagram to a JPG, SVG, BMP, PNG, or SVG image programmatically using Java:
Convert a Specific Page of Visio VSD/VSDX to Image using Java
You can convert a specific page of a VSD/VSDX file to an image file. You need to follow the steps below for rendering a specific page of a Visio diagram file to an image programmatically using Java:
- Firstly, load the input VSD/VSDX file using the Diagram class.
- Set the output image format like PNG.
- Mention the page index to render the image.
- Finally, save output image file with the Save method.
The following demonstrates how to convert a specific page in a Visio VSD/VSDX file to an image programmatically in Java:
Get Free API License
You can request a free evaluation license to evaluate the API without any limitations.
Conclusion
In this article, you have learned how to convert a Visio diagram VSD/VSDX file to a JPG, PNG, or TIFF image. You can render the whole diagram file or a specific page programmatically using Java. Moreover, you can explore other features of the API covered in the documentation section. Please feel free to write to us at the forum in case of any queries.