2003.09.05 00:02 "[Tiff] Problems with Postscript output from tiff2ps", by Morten Bagai

2003.09.05 00:02 "[Tiff] Problems with Postscript output from tiff2ps", by Morten Bagai

Hey there,

I am using libtiff with Ghostscript on redhat 7.3 in a solution that automates conversion of large, group4 compressed, multi-page tiff files to pdf files. The way I am doing this is basically by piping outfrom tiff2ps into the ps2pdf utility that comes with Ghostscript. Recently, I have run into a problem the postscript output created by tiff2ps. Since our tiff files are generated by some arcane batch scanning program, my solution will occasionally encounter a tiff file that has a corrupt page or two in it. Opening the source tiff file in any tiff viewer works fine, and you can see that all or part of the page in question is 'blacked out' or munged. When tiff2ps handles a file like this, it will generate the postscript output without any errors but there is something wrong with the result as ghostscripts pdf interpreter chokes on it and exits with an i/o error. The resulting pdf file has all the pages leading up to the bad page. I tried opening the postscript generated by tiff2ps in Adobe Acrobat 6 Pro, and I get exactly the same error as with Ghostscript. This led me to try and open the tiff file with Acrobat and saving it as a postscript file. If use Acrobat's postscript output with Ghostscript the pdf generation works just fine, leading me to conclude that there is something wrong with tiff2ps' postscript output.

Here's an example of what I do on the command line:

tiff2ps -a2 /pathto/sourcefile.tif  | ps2pdf -r240 -dProcessColorModel=/DeviceGray -dPDFSETTINGS=/printer - /pathto/destinationfile.pdf

My setup is the following:

libtiff version 3.5.7-2
redhat 7.3 i386
ghostscript 6.52 (but it appears this is not the issue even though i do plan on upgrading)

I'd be very grateful for any suggestions as to what might be going wrong, options to tinker with, known bugs etc. Also, I'd be interested in knowing if the beta version of libtiff 3.6 is supposed to fix anything that might impact this issue. I can provide the postscript files generated by libtiff and acrobat for the same file if that helps.