Tools to convert multipage PDF to multipage TIFF

William Seemann picture William Seemann · Apr 6, 2012 · Viewed 17.6k times · Source

I'm writing a small application to convert several multipage PDF's to multipage TIFF files. Per the other questions and answers on this site, I've tried both ghostscript and ImageMagick however both pieces of software only covert the first page when I run them. Are there any other tools I can use to accomplish this, preferably open source ones?

Answer

Kurt Pfeifle picture Kurt Pfeifle · Apr 6, 2012

Actually Ghostscript can convert a multi-page PDF into a multi-page TIFF. Just be sure to have a rather recent version of Ghostscript installed. Be careful when examining the resulting TIFF as your viewer may not show all the pages of the TIFF or it may not be apparent how to advance to subsequent pages in the TIFF.

Consider the following 3 commands:

gs                        \
  -o multipage-tiffg4.tif \
  -sDEVICE=tiffg4         \
   multipage-input.pdf

and

gs                          \
  -o multipage-tiff24nc.tif \
  -sDEVICE=tiff24nc         \
   multipage-input.pdf

and

gs                          \
  -o multipage-tiff32nc.tif \
  -sDEVICE=tiff32nc         \
   multipage-input.pdf

Each of these commands generates a multi-page TIFF, but with different output devices:

  1. The tiffg4 one is grayscale and uses a resolution of 204dpi by 196dpi (as the TIFF G4 fax standard requires).
  2. The tiff24nc one is in RGB color (with 8 bits per color component) and uses a resolution of 72dpi by 72dpi.
  3. The tiff32nc one is in CMYK color (with 8 bits per color) also using a resolution of 72dpi.

There are a number of additional output devices for TIFF at the link above.

All the resolution values for the TIFF files result from Ghostscript's default settings. If you want to override these, for example because you require 600dpi by 600dpi, just add

-r600x600

to any of the above commandlines.

To prove that you have multipage TIFFs, use the following command:

identify multipage-tiff*.tif

(identify is a command from the ImageMagick package, which you seem to have installed anyway.) As a result, you should see multiple lines for each of the *.tif files -- with each line representing 1 page of the respective *.tif.

I suspect it may have worked all the way for you -- that you were just unable to recognize the multiple pages in your resulting TIFFs. Not all TIFF viewers are able to display these -- they display the first page only if they can't otherwise, which may have fooled you.