Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Conversion of TIFF to PDF with Ghostscript

Could you tell me how can I convert TIFF to PDF with using Ghostscript or Postscript?

I tried to use this command:

gswin32c.exe -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=o.pdf test.tif

But it doesn't work.

It produces an error:

GPL Ghostscript 9.06 (2012-08-08)
Copyright (C) 2012 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Error: /undefined in II*
Operand stack:

Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1910   1   3   %oparray_pop   1909   1   3   %oparray_pop   1893   1   3   %oparray_pop   1787   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--
Dictionary stack:
   --dict:1169/1684(ro)(G)--   --dict:0/20(G)--   --dict:77/200(L)--
Current allocation mode is local
Current file position is 4
GPL Ghostscript 9.06: Unrecoverable error, exit code 1

like image 976
user2065631 Avatar asked Mar 04 '13 21:03

user2065631


1 Answers

The libtiff software package (available on all major OS platforms) ships with a command line tool called tiff2pdf.

$ tiff2pdf -h
  LIBTIFF, Version 4.0.3
  Copyright (c) 1988-1996 Sam Leffler
  Copyright (c) 1991-1996 Silicon Graphics, Inc.
  
  usage:  tiff2pdf [options] input.tiff
  options:
   -o: output to file name
   -j: compress with JPEG
   -z: compress with Zip/Deflate
   -q: compression quality
   -n: no compressed data passthrough
   -d: do not compress (decompress)
   -i: invert colors
   -u: set distance unit, 'i' for inch, 'm' for centimeter
   -x: set x resolution default in dots per unit
   -y: set y resolution default in dots per unit
   -w: width in units
   -l: length in units
   -r: 'd' for resolution default, 'o' for resolution override
   -p: paper size, eg "letter", "legal", "A4"
   -F: make the tiff fill the PDF page
   -f: set PDF "Fit Window" user preference
   -e: date, overrides image or current date/time default, YYYYMMDDHHMMSS
   -c: sets document creator, overrides image software default
   -a: sets document author, overrides image artist default
   -t: sets document title, overrides image document name default
   -s: sets document subject, overrides image image description default 
   -k: sets document keywords
   -b: set PDF "Interpolate" user preference
   -h: usage

So a simple command to get your PDF would be:

$ tiff2pdf -o output.pdf -p A4 -F test.tif
like image 56
Kurt Pfeifle Avatar answered Oct 19 '22 03:10

Kurt Pfeifle