/pdf2tiff

Convert PDF to Tiff

Primary LanguageKotlinApache License 2.0Apache-2.0

Publish package to the Maven Central Repository

Convert PDF to multi-page Tiff, using pdfbox and twelvemonkeys.

Regular conversion

// suggested dpi: 300, suggested compression: Deflate
Pdf2Tiff.INSTANCE.pdf2Tiff("my.pdf","my.tiff",300,"Deflate",ImageType.RGB);

Conversion with size control

If you want to control the size of the tiff, you can use the following code:

SizeControlParams sizeControl =
    new SizeControlParams.Builder()
        .maxFileSize(15000L) // 15KB max size
        .qualityParam(new QualityParams(300, "Deflate", ImageType.RGB)) // high quality
        .qualityParam(new QualityParams(200, "Deflate", ImageType.GRAY)) // if the above is above 15KB, try this
        .qualityParam(new QualityParams(100, "Deflate", ImageType.BINARY)) // if the above is above 15KB, try this
        .qualityParam(new QualityParams(50, "Deflate", ImageType.BINARY)) // if the above is under 15KB, this one won't be used
        .filePair("sample.pdf", "output.tiff")
        .build();

Pdf2Tiff.INSTANCE.pdf2Tiff(sizeControl);

Maven dependency

<dependency>
    <groupId>io.github.pdf2tiff</groupId>
    <artifactId>pdf2tiff</artifactId>
    <version>${pdf2tiff.version}</version>
</dependency>

Versions

Check for versions here: https://central.sonatype.com/artifact/io.github.pdf2tiff/pdf2tiff/versions