Convert PDF to TIFF
JPedal provides several methods to allow the rasterization of a PDF file or directory of PDF files into TIFF.
TIFF is the professional standard for archival and print workflows, supporting multiple compression schemes, high DPI metadata, and multi-page output. It is widely used in document management systems, scanning pipelines, and medical imaging.
JPedal uses JDeli for TIFF output. JDeli outperforms standard ImageIO for TIFF in benchmarks — it also provides standalone TIFF reading and writing.
New to JPedal? Add it to your project first: Maven dependency | Gradle dependency
How do I convert a PDF to TIFF from the command line?
JPedal can run as a standalone tool to convert a file or an entire directory in a single command:
java -jar jpedal.jar --convert "inputFileOrFolder" "outputFolder" tiff
You can also provide additional settings to control the output:
java -jar jpedal.jar --convert "inputFileOrFolder" "outputFolder" tiff ScalingAsFloat
java -jar jpedal.jar --convert "inputFileOrFolder" "outputFolder" tiff ScalingAsFloat PageRange
The named variables are:
- ScalingAsFloat: A float value specifying the scaling applied to the output. This is the view scaling divided by 100, for instance 150% becomes 1.5
- PageRange: The range of pages of convert. This follows the same rules as SetOfIntegerSyntax.
This can be a series of comma separated values which are either single page number or range between to values using a dash. For example “1,3,4-7” would give pages 1,3,4,5,6,7
You can also add JVM flags for more control over the output. These include,
- Setting Compression (image.tiff.compression)
- Setting DPI (image.tiff.dpi)
- Allowing multipage tiff output (org.jpedal.multipage_tiff)
All of these properties can be used in one of two ways.
- Set a system property within your code
For example,System.setProperty("org.jpedal.multipage_tiff", "true"); - Add the following property to the command line
For example,java -Dorg.jpedal.multipage_tiff=true -jar jpedal.jar --convert "inputFileOrFolder" "outputFolder"
What is the simplest way to convert a PDF to TIFF in Java?
The static convenience method converts a whole file or directory in a single call, handling file opening and closing automatically:
ConvertPagesToImages.writeAllPagesAsImagesToDir(
"inputFileOrFolder",
"outputFolder",
"tiff",
1.33f);
How do I control the TIFF output options when converting from PDF in Java?
To configure output settings — such as compression or quality — create a ConvertPagesToImages instance and apply an options object before writing each page:
ConvertPagesToImages convert = new ConvertPagesToImages("inputFile.pdf");
try {
if (convert.openPDFFile()) {
for(int page = 1; page <= convert.getPageCount(); page++) {
final BufferedImage bi = convert.getPageAsImage(page);
final File out = new File("outputFolder" + page + ".tiff");
// Setters to control output (example with compression)
final TiffEncoderOptions options = new TiffEncoderOptions();
options.setCompressionFormat(TiffCompressionFormat.DEFLATE);
options.setResolutionUnit(TiffResolutionUnit.INCH);
options.setXResolution(300);
options.setYResolution(300);
JDeli.write(bi, options, out);
}
}
} catch (PdfException | IOException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
convert.closePDFfile();
How do I convert specific pages of a PDF to TIFF in Java?
Use setPageRange with a PageRanges string before opening the file. The range syntax supports single pages, dash-separated ranges, and comma-separated combinations:
ConvertPagesToImages convert = new ConvertPagesToImages("inputFile.pdf");
// setPageRange gives you the ability to chose the pages you'd like using '-' or ':' for range
// and ',' to move to the next range or you can simply put null for all the pages
convert.setPageRange(new PageRanges("1-5,8:10,15"));
// Above will give us pages 1 to 5(inclusive),8 to 10(inclusive) and 15
try {
if (convert.openPDFFile()) {
convert.getPageRange().forEachRemaining(page -> {
try {
final BufferedImage bi = convert.getPageAsImage(page);
final File out = new File("outputFolder" + page + ".tiff");
JDeli.write(bi, options, out);
} catch (Exception e) {
e.printStackTrace();
}
});
}
} catch (PdfException e) {
e.printStackTrace();
}
convert.closePDFfile();
How do I create fixed-size TIFF thumbnails from a PDF in Java?
The static method accepts a {width, height} array to produce thumbnails at a fixed size:
ConvertPagesToImages.writeAllPagesAsImagesToDir(
"inputFileOrFolder",
"outputFolder",
"tiff",
new int[] {width, height});
Alternatively, use setFitToSize on a ConvertPagesToImages instance — JPedal preserves the aspect ratio and fits within the given dimensions:
ConvertPagesToImages convert = new ConvertPagesToImages("inputFile.pdf");
//fit with aspect ratio preserved (width will be 300 or height will be 400)
convert.setFitToSize(new int[] {300,400});
try {
if (convert.openPDFFile()) {
for (int page = 1; page <= convert.getPageCount(); page++) {
final BufferedImage bi = convert.getPageAsImage(page);
final File out = new File("outputFolder" + page + ".tiff");
JDeli.write(bi, OutputFormat.TIFF, out);
}
}
} catch (PdfException | IOException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
convert.closePDFfile();
How do I set the scaling when converting a PDF to TIFF in Java?
Use setPageScaling to control the output resolution. A value of 1.33f matches the default 100% view in Acrobat:
ConvertPagesToImages convert = new ConvertPagesToImages("inputFile.pdf");
convert.setPageScaling(1.33f); //which gives same size as Acrobat at 100%
try {
if (convert.openPDFFile()) {
for (int page = 1; page <= convert.getPageCount(); page++) {
final BufferedImage bi = convert.getPageAsImage(page);
final File out = new File("outputFolder" + page + ".tiff");
JDeli.write(bi, OutputFormat.TIFF, out);
}
}
} catch (PdfException | IOException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
convert.closePDFfile();
How do I convert a password-protected PDF to TIFF in Java?
Call setPassword before openPDFFile — the rest of the conversion works identically to an unprotected file:
ConvertPagesToImages convert = new ConvertPagesToImages("inputFile.pdf");
convert.setPassword("password");
try {
if (convert.openPDFFile()) {
for (int page = 1; page <= convert.getPageCount(); page++) {
final BufferedImage bi = convert.getPageAsImage(page);
final File out = new File("outputFolder" + page + ".tiff");
JDeli.write(bi, OutputFormat.TIFF, out);
}
}
} catch (PdfException | IOException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
convert.closePDFfile();
For the full API see the ConvertPagesToImages and TiffEncoderOptions Javadocs. For upscaling or more complex control over the PDF to TIFF conversion, ConvertPagesToHiResImages has lots of additional options
We also have a demo project on our GitHub page.
Frequently Asked Questions
Can I convert a whole directory of PDFs to TIFF?
Yes. Pass a folder path instead of a file path to any method — JPedal processes all PDFs found in that directory.
Can I convert specific pages of a PDF to TIFF?
Yes. Call convert.setPageRange(new PageRanges("1-5,8")) before openPDFFile(). The range syntax supports single pages, dash-separated ranges, and comma-separated combinations.
Can I convert a password-protected PDF to TIFF?
Yes. Call convert.setPassword("yourPassword") before openPDFFile().
How do I control the output resolution or DPI?
Use convert.setPageScaling(1.33f) — 1.33f matches Acrobat’s 100% view. For fixed pixel dimensions use convert.setFitToSize(new int[]{width, height}) instead.
Does JPedal require any third-party dependencies?
No. JPedal is a self-contained Java library with no third-party runtime dependencies.