
Convert PDF to SVG or PDF to TIFF in Java
Earlier we published a blog post on converting PDF to PNG or PDF to JPEG in Java application programmatically. In this article we show how to convert PDF to SVG or to TIFF in Java with just a few lines of code. The library provides fast, reliable conversion between popular file formats and integrates easily.
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 becomes easy after installing this Java library. You can either download the JAR files or use the Maven configuration 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 to SVG files, making SVG conversion a common requirement.
Follow these steps:
- 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 in Java:
How to Convert PDF to TIFF in Java Programmatically
This section explains how to automate 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 set 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.
The following sample code shows how to convert PDF to TIFF in Java:
Get a Free License
You may get a free temporary license to try the API without evaluation limitations.
Summing up
This concludes the guide on converting PDF to SVG or PDF to TIFF in Java. You now have sample code that converts PDFs to SVG and TIFF images programmatically. The process is lightweight and efficient. Explore more features in the documentation. Stay updated with new posts on conholdate.com.
Ask a question
In case of any queries please feel free to write to us at the forum.