[off-topic] How can I "tumble" output of -sDEVICE=tiffg4 ?

Kurt Pfeifle kurt.pfeifle at infotec.com
Fri Jul 4 08:37:02 PDT 2008


>> The problem at hand seems very easy, but I nevertheless already managed to waste many hours in pursuing a solution. I'm batch-converting thousands of PDF files with the help of Ghostscript, using this commandline:
>>
>> 	gs \
>>         -sDEVICE=tiffg4 \
>>         -dBATCH \
>>         -dNOPAUSE \
>>         -r600x600 \
>>         -g10592x7040 \
>>         -sOutputFile=${tiffdir}/p%08d.tif \
>>         ${pdfdir}/${pdffile:1} \
>> 		2>&1 >> ${tiff_err_file}.$$
>>
>> (where the variables are serving an obvious purpose). The input PDF files are A3 oversized (1270 x 842 pts).
>>
>> Ghostscript (I'm using 8.62 on Solaris 10, Ultra-45 SPARC) does its job just fine, with correct orientation also in all image viewer applications.
>>
>> However, here's my problem:
>>
>>     =======================================================================
>>      Since some of the TIFFs later are printed on paper, and the printer's
>> 	 finishing devices are not adjustable, I'd need to create some of the
>> 	 TIFF images tumbled "upside down".
>>     =======================================================================

[....]
>> I already tried different variations of inserting "-c [some-valid-PostScript-code-here]" to the Ghostscript commandline, but it did not change anything. (I don't know if that kind of PostScript code snippet insertion is supposed to work at all if the Ghostscirpt input files are PDF. Example:
>>
>> 	gs  \
>>         -sDEVICE=tiffg4 \
>>         -dBATCH \
>>         -dNOPAUSE \
>>         -r600x600 \
>>         -g10592x7040 \
>>         -sOutputFile=${tiffdir}/p%08d.tif \
>>         -c "<< /Orientation 2 >> setpagedevice" -f \
>>         ${pdfdir}/${pdffile:1} \
>>         2>&1 >> ${tiff_err_file}.$$
>>
>> I tried all "/Orientation 0", "/Orientation 1" and "/Orientation 3" as well. Other switches I tried (I googled a lot) included:

[....]

> For the pages to be rendered upside down, use
> ---snip---
> <</BeginPage
>      {pop currentpagedevice/PageSize get aload pop exch pop % page length on stack
>      1 -1 scale 0 exch translate % flip vertical ans move up by the page hight
>      }bind
>  >>setpagedevice
> ---snip---
> You best put this into a file, say, prolog.ps, and insert it just
> after the -f switch, preceding the TIFF file.
>
> Helge


Hi, Helge,

thanks for your suggestion.

However, I'm not sure I understand it correctly. My original commandline does not have a -f switch. Are you saying that I should put this prolog.ps into the second commandline, where I tried to add a setpagedevice statement for the orientation (but which was ignored)?

Anyway, I can't test it right now, but will play with it again later tonight.

Thanks & cheers,
Kurt




More information about the cups mailing list