tiff2pdf Command in Linux



The tiff2pdf command in Linux converts a TIFF file to a PDF document. It does support multi-page TIFF files, but it only converts one TIFF file at a time into one PDF file. So, if a single TIFF contains multiple pages, all of them will be included in the output PDF.

Table of Contents

Here is a comprehensive guide to the options available with the tiff2pdf command −

Installation of tiff2pdf Command

The tiff2pdf command is part of the libtiff-tools package in Linux. Make sure the package is installed before using the command. To install it on Ubuntu, Kali Linux, Raspberry Pi OS, Debian, and other Debian-based distributions, use the following command −

sudo apt install libtiff-tools

To install it on Arch Linux, use the command below −

sudo pacman -S libtiff

To install libtiff-tools on Fedora, use the following command −

sudo dnf install libtiff-tools

To verify the installation of the tiff2pdf command, check its binary using the which command −

which tiff2pdf
tiff2pdf Command in Linux1

Syntax of tiff2pdf Command

The syntax of the tiff2pdf command in Linux is as follows −

tiff2pdf [options] [input.tiff]

In the above syntax, the [options] argument is used to specify the options. The [input.tiff] argument is used to specify the TIFF file to convert to PDF.

tiff2pdf Command Options

The options of the tiff2pdf command are listed below −

Option Description
-o <file> Set output PDF filename.
-j Use JPEG compression (requires libjpeg).
-z Use Zip/Deflate compression (requires zlib).
-q <1–100> Set JPEG compression quality.
-n Disallow compressed data passthrough; forces decompression.
-b Enable PDF Interpolate viewer preference.
-d Disable compression (decompress input).
-i Invert image colors.
-p <size> Set paper size (e.g., letter, legal, A4).
-u [i|m] Set measurement units: i = inches, m = centimeters.
-w Set page width.
-l Set page length.
-x Set horizontal resolution.
-y Set vertical resolution.
-r [d|o] d: use default DPI if missing; o: override DPI for all images.
-f Enable PDF Fit Window viewer preference.
-e Set document date (YYYYMMDDHHMMSS).
-c Set PDF creator metadata.
-a Set PDF author metadata.
-t Set PDF title metadata.
-s Set PDF subject metadata.
-k Set PDF keywords.
-h Show usage help and exit.

Examples of tiff2pdf Command in Linux

This section demonstrates how to use the tiff2pdf command in Linux with examples −

  • Converting a Single TIFF to a PDF Document
  • Converting a TIFF to a PDF Document with JPEG Compression
  • Converting a TIFF to a PDF Document with ZIP Compression
  • Setting Paper Size
  • Setting PDF Metadata
  • Inverting Colors of the TIFF File before Conversion
  • Setting Custom Resolution
  • Setting Page Width and Length
  • Displaying Usage Help

Converting a Single TIFF to a PDF Document

To convert a single TIFF image to PDF, use the tiff2pdf command followed by the source TIFF file −

tiff2pdf sample.tiff

The above command writes the output to stdout. To save the output to a file, use the -o option.

tiff2pdf -o output.pdf sample.tiff 
tiff2pdf Command in Linux2

Converting a TIFF to a PDF Document with JPEG Compression

To convert a TIFF file to a PDF document with JPEG compression, use the -j option −

tiff2pdf -o output.pdf -j sample.tiff

Converting a TIFF to a PDF Document with ZIP Compression

To convert a TIFF file to a PDF document with ZIP/deflated compression, use the -z option −

tiff2pdf -o output.pdf -z sample.tiff

Setting Paper Size

To set the paper size, use the -p option followed by the paper size, such as A4, legal, or letter −

tiff2pdf -o output.pdf -p A4 sample.tiff

To verify the page size, use the following command −

pdfinfo output.pdf
tiff2pdf Command in Linux3

Setting PDF Metadata

To set the PDF metadata, various options are used, such as -c, -a, -t, -s, and -k. For example, to set the author and title, use the -a and -t options −

tiff2pdf -o output.pdf -a "Sam" -t "TIFF to PDF" sample.tiff
tiff2pdf Command in Linux4

Inverting Colors of the TIFF File before Conversion

To invert the colors of the TIFF file before conversion, use the -i option −

tiff2pdf -o output.pdf -i sample.tiff

Setting Custom Resolution

To set the custom resolution, use the -x and -y options followed by DPI −

tiff2pdf -o output.pdf -x 150 -y 150 -r o sample.tiff
tiff2pdf Command in Linux5

Setting Page Width and Length

To set the page width and length, use the -w and -l options.

tiff2pdf -o output.pdf -u i -w 8.5 -l 11 sample.tiff

The -u option in the above command, followed by i sets the units in inches.

Displaying Usage Help

To display the usage help of the tiff2pdf command, use the -h option −

tiff2pdf -h

Conclusion

The tiff2pdf command in Linux is used to convert TIFF files into PDF documents and supports multi-page TIFFs by including all pages in the output. It is part of the libtiff-tools package and offers a range of options for compression, page size, resolution, and metadata settings.

Advertisements