Convert PDF to SVG or PDF to TIFF in Java

Convert PDF to SVG or PDF to TIFF in Java

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

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

<repository>
    <id>AsposeJavaAPI</id>
    <name>Aspose Java API</name>
    <url>https://repository.aspose.com/repo/</url>
</repository>

Dependency

<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:

  1. Set the path of source & output PDF files.
  2. Create an instance of the Document class and load the PDF document.
  3. Instantiate an object of SvgSaveOptions class to access the export to SVG format features.
  4. Call this setCompressOutputToZipArchive method to Specify whether the output will be created as one zip archive.
  5. 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:

  1. Initialize an instance of the Document class and load the PDF document.
  2. Set the resolution of the image by creating an object of Resolution.
  3. Create an object of TiffSettings class to configure the settings.
  4. Call setCompression method to sets the type of the compression.
  5. setDepth method will set the color depth.
  6. setShape method will set the type of the shape.
  7. Instantiate an instance of TiffDevice class to save pdf documents page by page into the one tiff image.
  8. 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.

Summing up

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.

See Also