In the recent past, we published a blog post that covers the conversion from PDF to PNG or PDF to JPEG in Java application programmatically. However, in this article, we will see how to convert PDF to SVG or PDF to TIFF in Java using a few lines of code in a Java application. This library offers robust, optimized, manipulation conversion among popular file formats. In addition, the integration process of this library is quite easy and simple.
We will cover the following points:
- Convert PDF to SVG or PDF to TIFF in Java - API installation
- Java library to convert PDF to SVG
- How to convert PDF to TIFF in Java Programmatically
Convert PDF to SVG or PDF to TIFF in Java - API installation
File format conversion and manipulation becomes pretty easy by installing this Java library in your Java application. You can either download the jar files or you can follow the 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-pdf</artifactId> <version>20.12</version> <classifier>jdk17</classifier> </dependency>
Java library to convert PDF to SVG
You can compress, index, and add scripts in the SVG files. Therefore, most of the cases require the conversion of files to the SVG file format.
You can follow the following steps to achieve this conversion:
- Set the path of source & output PDF files.
- Create an instance of the Document class and load the PDF document.
- Instantiate an object of SvgSaveOptions class to access the export to SVG format features.
- Call this setCompressOutputToZipArchive method to Specify whether the output will be created as one zip archive.
- Save the output in SVG files.
Copy and paste the following code to convert PDF to SVG programmatically:
How to convert PDF to TIFF in Java Programmatically
This section will learn how to automate the PDF to TIFF conversion using Java.
We will complete this section by covering the following steps:
- Initialize an instance of the Document class and load the PDF document.
- Set the resolution of the image by creating an object of Resolution.
- Create an object of TiffSettings class to configure the settings.
- Call setCompression method to sets the type of the compression.
- setDepth method will set the color depth.
- setShape method will set the type of the shape.
- Instantiate an instance of TiffDevice class to save pdf documents page by page into the one tiff image.
- Invoke process method that converts a PDF file to a TIFF image.
Get a Free License
You may get a free temporary license to try the API without evaluation limitations.
We are ending the blog post here. We have gone through how to convert PDF to SVG or PDF to TIFF in Java. Now, we have the source code that converts PDF to SVG and PDF to TIFF images programmatically. The whole procedure is lightweight and efficient. There are many other features available that you can explore in the documentation. Finally, conholdate.com is writing new blog posts on other topics. Therefore, please stay in touch for regular updates.
Ask a question
In case of any queries please feel free to write to us at the forum.