A Java program to convert a PDF file to a single, multi-page TIFF file using Qoppa’s library Java PDF image library jPDFImages.
import com.qoppa.pdf.TIFFOptions; import com.qoppa.pdfImages.PDFImages; public class PDFToTIFF { public static void main (String [] args) { try { PDFImages pdfDoc = new PDFImages ("input.pdf", null); TIFFOptions options = new TIFFOptions (150, TIFFOptions.TIFF_PACKBITS); pdfDoc.saveDocumentAsTIFF("output.tif", options); } catch (Throwable t) { t.printStackTrace(); } } } |
The compression parameter can be any of the following:
TIFFOptions.TIFF_DEFLATE – Deflate lossless compression (Zip-in-TIFF)
TIFFOptions.TIFF_CCITT_RLE – CCITT Modified Huffman RLE
TIFFOptions.TIFF_CCITT_T4 – CCITT Group 3 fax encoding
TIFFOptions.TIFF_CCITT_T6 – CCITT Group 4 fax encoding
TIFFOptions.TIFF_JPEG – JPEG-in-TIFF compression.
TIFFOptions.TIFF_LZW – LZW Compression
TIFFOptions.TIFF_PACKBITS – Byte-oriented run-length encoding “PackBits” compression.
TIFFOptions.TIFF_ZLIB – ZLib Compression.
TIFFOptions.TIFF_NO_COMPRESSION – No compression