Java: Convert PDF to TIFF

The Tagged Image File Format (TIFF) is a relatively flexible image format which has the advantages of not requiring specific hardware, as well as being portable. Spire.PDF for Java supports converting TIFF to PDF and vice versa. This article will show you how to programmatically convert PDF to TIFF using it from the two aspects below.

Install Spire.PDF for Java

First of all, you're required to add the Spire.Pdf.jar file as a dependency in your Java program. The JAR file can be downloaded from this link. If you use Maven, you can easily import the JAR file in your application by adding the following code to your project's pom.xml file.

<repositories>
    <repository>
        <id>com.e-iceblue</id>
        <name>e-iceblue</name>
        <url>https://repo.e-iceblue.com/nexus/content/groups/public/</url>
    </repository>
</repositories>
<dependencies>
    <dependency>
        <groupId>e-iceblue</groupId>
        <artifactId>spire.pdf</artifactId>
        <version>10.10.7</version>
    </dependency>
</dependencies>
    

Convert All Pages of a PDF File to TIFF

The following steps show you how to convert all pages of a PDF file to a TIFF file.

  • Create a PdfDocument instance.
  • Load a PDF sample document using PdfDocument.loadFromFile() method.
  • Save all pages of the document to a TIFF file using PdfDocument.saveToTiff(String tiffFilename) method.
  • Java
import com.spire.compression.TiffCompressionTypes;
import com.spire.pdf.PdfDocument;

public class PDFToTIFF {
    public static void main(String[] args) {

        //Create a PdfDocument instance
        PdfDocument pdf = new PdfDocument();
       
 //Load a PDF sample document
        pdf.loadFromFile("sample.pdf");

        //Save all pages of the document to Tiff
        pdf.saveToTiff("output/PDFtoTiff.tiff");
     }
}

Java: Convert PDF to TIFF

Convert Some Specified Pages of a PDF File to TIFF

The following steps are to convert specified pages of a PDF document to a TIFF file.

  • Create a PdfDocument instance.
  • Load a PDF sample document using PdfDocument.loadFromFile() method.
  • Save specified pages of the document to a TIFF file using PdfDocument.saveToTiff(String tiffFilename, int startPage, int endPage, int dpix, int dpiy) method.
  • Java
import com.spire.pdf.PdfDocument;

public class PDFToTIFF {
    public static void main(String[] args) {
        //Create a PdfDocument instance
        PdfDocument pdf = new PdfDocument();
 
       //Load a PDF  sample document
        pdf.loadFromFile("sample.pdf");

        //Save specified pages of the document to TIFF and set horizontal and vertical resolution
        pdf.saveToTiff("output/ToTiff2.tiff",0,1,400,600);
    }
}

Java: Convert PDF to TIFF

Apply for a Temporary License

If you'd like to remove the evaluation message from the generated documents, or to get rid of the function limitations, please request a 30-day trial license for yourself.