Are you looking to convert Visio to PDF in Java programmatically? This blog post will teach you how to manipulate and convert VSD/VSDX files to PDF file format using a few lines of code in Java. Visio diagrams are widely used to generate various designs of business processes and workflows. However, you need to transform your visio diagrams to other popular file formats such as PDF, PNG and more. This Java Visio API offers a wide range of classes and methods to achieve this functionality.
We will cover the following points in this article:
- Java Visio API installation
- How to convert Visio to PDF in Java
- Visio to PDF conversion - advanced methods
Java Visio API installation
This library is easy to install and offers comprehensive documentation where you can find a huge stack of methods and installation instructions. However, you can enable this API by either downloading the JAR files or following Maven configurations mentioned below:
<repository> <id>AsposeJavaAPI</id> <name>Aspose Java API</name> <url>https://repository.aspose.com/repo/</url> </repository> <dependency> <groupId>com.aspose</groupId> <artifactId>aspose-diagram</artifactId> <version>22.7</version> </dependency>
How to convert Visio to PDF in Java
Visio diagrams offer rich modeling features for creating process diagrams. In this section, we are going to go through the steps and the code snippets to convert VSD to PDF programmatically.
You may follow the steps mentioned below:
- Call the Diagram constructor to load the diagram from a VSD file.
- Invoke the save method to save as PDF file format.
You can see the output in the image below:
Visio to PDF conversion - advanced options
You can also configure the API calls as per your business requirements.
We will explore some key features by following the steps and the code snippets:
- Create an object of the Diagram class to load the diagram from a VSDX file.
- Instantiate an instance of PdfSaveOptions class to specify additional options when rendering diagram pages to PDF.
- Pass a value to the SplitMultiPages method to define whether split diagram to multi-pages according to page’s setting option.
- Specify the quality of JPEG compression for images by calling the setJpegQuality method.
- Invoke the setPageSize method to sets the page size for the generated images.
- Call the save method to save in PDF format.
Get a Free License
You can get a free temporary license to try the API without evaluation limitations.
This brings us to the end of this article. Hope you have learned how to convert Visio to PDF in Java programmatically. In addition, we also have explored some advanced options that offer enterprise-level Visio to PDF conversion features. Moreover, you may visit the documentation of this Java Visio API to know about other methods. Further, conholdate.com is writing new blog posts on new topics. Therefore, please stay in touch for regular updates.
Ask a question
You can let us know about your questions or queries on our forum.
How do I convert a Visio file to PDF?
You can convert VSD/VSDX to PDF using this Java Visio API. It is rich-featured and offers a wide range of methods to convert Visio to PDF in Java.
How do I save a large Visio file as a PDF?