# tiff2pdf – Convert TIFF Files to PDF

Version: 2.1

Part of DaVince Tools

Last Modified: December 1, 2002

Command Syntax

Description

Problem TIFF Files

New Features / Changes

Additional Information

About DaVince Tools

## Command Syntax

Refer to the "DaVince Tools" Converters page for a description of the command line syntax for all converters.

## Description

"tiff2pdf" is a command line program that converts TIFF (Tagged Image File Format) files to PDF (Portable Document Format) files (for a Windows interface to this program, see wdavince). The program can convert a TIFF file by either recompressing the data for PDF use or taking the raw image data from the file "as is" and putting it into a PDF wrapper when possible. This analogous to removing a letter from a letter size envelope and placing it in a business size envelope. The original image data is unaltered, so no data recompression is required (not all TIFF raw image data is compatible with PDF; these files will automatically be recompressed). The key features of this program are:

- TIFF compression modes 1, 2, 3, 4 and 32773 support
- Single and multi-strip file support
- Tiled TIFF file support
- Single and multi-page file support
- Monochrome, grayscale and color (indexed, RGB and CMYK) image support
- Thumbnail and bookmark support
- Convert many TIFF files to one PDF (many to one), create a PDF file for each specified TIFF file (one to one), or create a PDF file for each TIFF subdirectory specified (many to few)
- Individual filenames with wildcard support and/or an entire directory may be specified for conversion
- Specify files or directories to convert either via the command line or a command file
- Large file support (1,000+ pages)
- Compatible with Acrobat Capture for OCR conversion of image data
- Creates a version 1.2 PDF file with a unique file ID in trailer
- Quick conversion of data option uses existing compressed image data in PDF file, resulting in faster conversion time
- Archive conversion of data option recompresses image data creating smaller PDF files in many cases

The following TIFF tags are required in order for the file to be converted. If any of these tags are missing, the application will skip over the image. The "tiffdump" program, part of DaVince Tool set, can be used to display the tags of a TIFF file.

ImageLength | The # of scan lines of an image
ImageWidth | The # of pixels in a scan line of an image
Compression | The type of compression used (valid values are: 2 (Modified Huffman), 3 (Group 3) and 4 (Group 4)
StripOffsets/TileOffsets | Array of one or more offsets to image data
StripByteCounts/TileByteCounts | Array of one or more values of lengths pointed to by the StripOffsets tag for stripped images, or TileOffsets for tiled images
TileLength | The # of scan lines in a tile (only required for tiled Tiff images)
TileWidth | The # of pixels in a scan line in a tile (only required for tiled Tiff images)

The following TIFF tags are recognized by tiff2pdf but are not required for a conversion.

NewSubFileType | Used to skip over thumb nail and transparency mask images
Xresolution | The scan resolution in the X direction. If this tag is not present, then either 300 dpi or the resolution specified by the DefaultDPI option is used.
Yresolution | The scan resolution in the Y direction. If this tag is not present, then either 300 dpi or the resolution specified by the DefaultDPI option is used.
ResolutionUnit | Used to specify the XResolution and Yresolution tags are in inches or centimeters (default is ‘inches’ if tag is not present)
BitsPerSample | Number of bits per component.
SamplesPerPixel | The number of components per pixel. SamplesPerPixel is usually 1 for bilevel, grayscale, and palette-color images. SamplesPerPixel is usually 3 for RGB images.
T4Options | Used to determine 1 or 2 dimensional encoding and byte aligned rows for compression type 2.
PhotometricInterpretation | Used to determine if the data is black and white, pallete color, RGB color, CMYK color or grayscale. For black and white data, this also specifies if the zero pixel is either black or white
FillOrder | The program supports the FillOrder tag.

The height, width and resolution tags are used to determine the physical page size. For example, an image 2,544 pixels wide and 3,287 pixels long and scanned at 300 DPI results in a PDF page size of 2,544/300 by 3,287/300, or 8.48 inches wide by 10.96 inches long. The resulting page size may not match a standard paper size, however, this is not a problem for viewers like Adobe Acrobat. The advantage to this method is that a multiple page conversion can contain images scanned at different sizes. This allows, for example, a converted PDF file to contain both U.S. letter and legal size pages, as well as differing European sizes (A1, A2, etc.) or even a combination of the two.

The screen output can be redirected to a file adding the DOS syntax ">filename" to the end of the command line. This can be used to redirect output to a log file. The program returns an error code of 1 when a fatal error occurs, used in batch programs to test the success of the program.

The initialization file and the use of profiles is described in the "DaVince Tools" Converters page. In addition to the default profile, the following sample profiles are defined in the tiff2pdf.ini file that ships with the program:

Profile Name | Description
quick | Best for compression speed, no bookmarks or thumbnails.
quickbookmark | Best for compression speed, with bookmarks.
archive | Best for optimal file size, no bookmarks or thumbnails.
bookmark | Best for optimal file size, with bookmarks.
thumbnail | Best for optimal file size with bookmarks and thumbnails.

## Common Profile Settings

Refer to the "DaVince Tools" Converters page for a description of the common profile settings.

## Converter Specific Settings

The following table describes tiff2pdf settings that are unique to this converter (options are case insensitive):

Option | Data Type | Description
Archive | Bool | When true, compress image data in an optimal manner. When archive option is set to true, converted page indicator is a plus sign ("+"). When archive option is set to false, converted page indicator is a period ("."). Archive mode is automatically turned on for image formats that are not supported natively in PDF (PackBits and CCITT Group 3 with unsupported Group 3 options are examples). The default is false.
DamagedRowCount | Number | This parameter is used when a TIFF file was received from a Group 3 Facsimili device and contains transmission errors. Setting this parameter to a positive number will allow the PDF reader to accept files with damaged rows up to this value. A value of "1" or "2" may be sufficient for most users. This parameter is only used with Group 3 files. Group 4 files are not affected. This option is not used when "archive" is set to true. By default, this value is "0" (no damaged rows allowed).
DefaultDPI | Number (in DPI) | Default resolution to use if resolution tag is not present. The program will assume 300 DPI if this option not present.
MaxImageSize * | Number (in MB) | Maximum image size (in megabytes) in the PDF file. Images larger than this size will be split into 1 or more smaller images not to exceed this value. The default settings is 20 MB.
Transparency | Bool | When true, make image background transparent, useful with other programs that create watermarks. When false, make image background opaque. If using Acrobat Capture for OCR conversion with the resulting PDF file, this must be set to false. The default value is false.
Thumbnail | Bool | Create thumbnail images. Note that this will increase processing time, even when the "Archive" option is set to false. The default is false.

* New in 2.1

## Problem TIFF Files:

Not all TIFF files can be converted with this application. One should verify the correctness of the conversion by viewing the PDF file with a PDF viewer. Listed below are reasons why a TIFF file may not be converted:

- Monochrome, gray scale and color TIFF files with compression mode 1 (uncompressed), 2 (Huffman), 3 (CCITT Group 3), 4 (CCITT Group 4) or 32773 (Packbits), are supported. Mode 5 compression (LZW), typically used for compressing color images, is supported only when "archive" is set to false. Indexed, RGB and CMYK color images are supported. JPEG compressed TIFF files are not supported.
- The following TIFF tags are required: ImageLength, ImageWidth, Compression, StripOffsets/TileOffsets and StripByteCounts/TileByteCounts. Most TIFF reading applications require these tags.
- Starting with version 1.1, the TIFF tag FillOrder is supported. Versions of tiff2pdf prior to version 1.1 will not convert these files.
- Not all CCITT compressed images can be copied to the PDF file unaltered. In particular, compressed images containing the T4Option tag with bit 2 set can not be converted as-is, since there is no equivalent T4 option in the PDF specification. tiff2pdf will recompress this image if it detects this bit is set (Note: releases of tiff2pdf prior to version 2 generated an error). For a technical description about bit 2 in the T4Option tag, the TIFF 6 Specification describes it as follows:

Bit 2 is 1 if fill bits have been added as necessary before EOL codes such that EOL always ends on a byte boundary, thus ensuring an EOL-sequence of 1 byte preceded by a zero nibble: xxxx-0000 0000-0001.

- Certain TIFF files generated with version 1.1.0 of tiff2pdf generated a "Read less image data than expected" error in Acrobat Reader and Exchange. This problem was fixed in version 1.1.1. If you still receive this error when using version 1.1.1 or later of tiff2pdf, then the image data may be at fault. Certain programs (typically older programs) that create TIFF files truncate the bottom of the page if there is no image data to display. Specifying an image height and then storing image data of a lesser height does not conform to industry practices and Acrobat complains about it. tiff2pdf also complains about it when generating a thumbnail for this image. Acrobat still allows viewing and printing of this image despite the error. To remove the error message you should recompress the image data by using a profile with the archive option enabled

## New Features / Changes:

A list of new features and changes, along with a version history, can be found in the release notes.

## Additional Information:

Any DaVince Tool product that creates a PDF must create an intermediate file prior to writing the PDF file. The filename of this intermediate file begins with "tmps" and appears in the directory pointed to by the environment variable "TMP". If this environment does not exist, then the temporary file is written in the current directory. The intermediate file exists only during the execution of the program.

##

## About DaVince Tools:

Visit the DaVince Tools web site at http://www.davince.com for the latest version of this software and the latest documentation. DaVince Tools is shareware and software registration is urged if you find these programs useful. You can register the software on-line at http://www.davince.com.

DaVince Tools was written in C++ using the DaVince Class Library, written by the same author as this program. The DaVince Class Library is a C++ library for developing PDF and TIFF applications. Contact the author at info@davince.com for more information on the availability of the class library.