Tools to convert multipage PDF to multipage TIFF [closed]

て烟熏妆下的殇ゞ 提交于 2019-12-03 09:53:33

问题


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?


回答1:


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.




回答2:


You can also use Imagick php extension if you are interested in doing it in php instead of bash script.



来源:https://stackoverflow.com/questions/10037101/tools-to-convert-multipage-pdf-to-multipage-tiff

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!