使用Ghostscript将TIFF转换为PDF

use*_*631 6 pdf tiff postscript ghostscript

你能告诉我如何使用Ghostscript或Postscript将TIFF转换为PDF?

我试着使用这个命令:

gswin32c.exe -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=o.pdf test.tif
Run Code Online (Sandbox Code Playgroud)

但它不起作用.

它会产生错误:

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

Kur*_*fle 8

libtiff软件包(可在所有主要操作系统平台上使用)附带一个名为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
Run Code Online (Sandbox Code Playgroud)

因此,获取 PDF 的简单命令是:

$ tiff2pdf -o output.pdf -p A4 -F test.tif
Run Code Online (Sandbox Code Playgroud)


Ken*_*enS 7

Ghostscript读取PDF和PostScript作为输入,它不读取图像格式,特别是不读取TIFF.但PostScript是一种编程语言,因此完全可以编写PostScript程序来读取TIFF文件(Ghostscript提供的viewgif.ps和viewjpeg.ps程序为GIF和JPEG格式执行此操作)

我确实有一个程序可以执行此操作,直到某个点,并且已经在comp.lang.postscript上发布了几次.它有点大的分享(33Kb),但如果你有兴趣,我可以给你发电子邮件.

  • 使用有趣的搜索字符串"ken read tiff"找到了一个链接(https://groups.google.com/d/msg/comp.lang.postscript/xLMTVNzGNXQ/g7gItvNwPEIJ).非常好的工作!+1 (2认同)