简体   繁体   English

如何使用 ghostscript 命令在不同目录中压缩 pdf?

[英]How can I compress a pdf in a different directory using ghostscript command?

How can I compress a pdf in a different directory using the command below?:如何使用以下命令在不同目录中压缩 pdf?:

ghostscript -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/printer -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf

/books/input.pdf instead of input.pdf Doesn't compress the input.pdf which is in the /books directory. /books/input.pdf 而不是 input.pdf 不压缩/books目录中的 input.pdf。

I am using ghostscript4js in my node app to compress pdf using the commands but the pdf needs to be at the same directory as the server.js file to be able to compress it.我在我的节点应用程序中使用 ghostscript4js 使用命令压缩 pdf,但 pdf 需要与 server.js 文件位于同一目录中才能压缩它。 Since I want to keep my pdfs in a separate directory (ie /books) I wonder how can I do that?由于我想将我的 pdf 文件保存在一个单独的目录中(即 /books),我想知道我该怎么做? And also can I output into a different directory?我也可以输出到不同的目录吗?

/books/input.pdf 不起作用,我应该使用的是./books/input.pdf

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM