问题描述
我发现此整洁的命令可以使用Ghostscript将多个PDF合并为一个
I found this neat command to merge multiple PDF into one, using Ghostscript:
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=out.pdf in1.pdf in2.pdf
结果大小小于2个PDF的总大小.
The resulting size is smaller than the combined size of the 2 PDFs.
以单个文件作为输入运行命令仍会导致输出文件较小.
Running the command with a single file as input still results to a smaller size output file.
Ghostscript上是否有一个选项可以仅复制合并时显示的页面而无需进行任何压缩?
Is there an option on Ghostscript to just copy the pages as they appear on merging without doing any compression?
如果不是,那么Ghostscript压缩是否可能会如此好,从而绝对不会导致质量损失?
If not, is it possible that the Ghostscript compression is so good that it will result in absolutely no loss in quality?
推荐答案
以下是一些其他使用pdfwrite
作为设备时可以通过的选项.根据该页面,如果您不传递任何内容,则-dPDFSETTINGS
设置为接近/screen
的值,尽管它没有更具体.您可以尝试将其设置为-dPDFSETTINGS=/prepress
,它只能压缩高于300 dpi的内容.
Here's some additional options that you can pass when using pdfwrite
as your device. According to that page if you don't pass anything then -dPDFSETTINGS
it gets set to something close to /screen
, although it doesn't get more specific. You could try setting it to -dPDFSETTINGS=/prepress
which should only compress things above 300 dpi.
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress -sOutputFile=out.pdf in1.pdf in2.pdf
另一种替代方法是 pdftk :
pdftk in1.pdf in2.pdf cat output out.pdf
这篇关于合并PDF的Ghostscript压缩结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!