Answers:
您可以按以下方式使用gs
-GhostScript(PostScript和PDF语言解释器和预览器):
-sDEVICE=pdfwrite
使用适当的-dPDFSETTINGS
。
从文档:
-dPDFSETTINGS =配置
将“蒸馏器参数”预设为四个预定义设置之一:
- / screen选择类似于Acrobat Distiller“屏幕优化”设置的低分辨率输出。
- / ebook选择类似于Acrobat Distiller“ eBook”设置的中等分辨率输出。
- / printer选择类似于Acrobat Distiller“打印优化”设置的输出。
- / prepress选择类似于Acrobat Distiller“ Prepress Optimized”设置的输出。
- / default选择旨在在多种用途中有用的输出,可能以较大的输出文件为代价。
-o
输出文件的选项,该文件也设置-dNOPAUSE
和-dBATCH
(请参阅与交互有关的参数)例:
$ du -h file.pdf
27M file.pdf
$ gs -sDEVICE=pdfwrite -dPDFSETTINGS=/ebook -q -o output.pdf file.pdf
$ du -h output.pdf
900K output.pdf
tesseract
尝试使用此命令收缩时,可搜索的PDF输出由保持完全不变。
gs
,它给出了以下示例:ps2pdf -dPDFSETTINGS=/prepress figure.ps proof.pdf
您可以尝试以下方法:
$ time pdftk myFile.pdf output myFile__SMALLER.pdf compress
GC Warning: Repeated allocation of very large block (appr. size 16764928):
May lead to memory leak and poor performance.
GC Warning: Repeated allocation of very large block (appr. size 8384512):
May lead to memory leak and poor performance.
GC Warning: Repeated allocation of very large block (appr. size 11837440):
May lead to memory leak and poor performance.
GC Warning: Repeated allocation of very large block (appr. size 8384512):
May lead to memory leak and poor performance.
GC Warning: Repeated allocation of very large block (appr. size 33525760):
May lead to memory leak and poor performance.
GC Warning: Repeated allocation of very large block (appr. size 7254016):
May lead to memory leak and poor performance.
GC Warning: Repeated allocation of very large block (appr. size 34041856):
May lead to memory leak and poor performance.
GC Warning: Repeated allocation of very large block (appr. size 33525760):
May lead to memory leak and poor performance.
real 0m23.677s
user 0m23.142s
sys 0m0.540s
$ du myFile*.pdf
108M myFile.pdf
74M myFile__SMALLER.pdf
它比gs
107.5MiB输入文件要快,但在这种情况下最多可压缩30%。
tesseract
尝试使用此命令收缩时,可搜索的PDF输出由保持完全不变。
tesseract
尝试使用此命令收缩时,可搜索的PDF输出由保持完全不变。