Linux 命令行实用程序可删除 PDF 文件中的颜色?
我正在寻找能够删除 PDF 中颜色的 Linux 命令行实用程序/脚本。该实用程序的输出应该是相同的 PDF,但为灰度。
有谁知道该怎么做?
谢谢
I'm searching for a linux command-line utility/script capable of removing colors in a PDF. The output of the utility should be the same PDF, but in grayscale.
Does anyone know how to do this?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 Ghostscript:(
示例适用于 Windows;在 Linux 上使用
gs
而不是gswin32c.exe
和\
作为行继续标记而不是<代码>^)。更新
如果颜色转换无法按预期工作,并且如果您看到类似“无法将颜色空间转换为灰色,将策略恢复为 LeaveColorUnchanged”的消息,那么...
在这种情况下添加
-dOverrideICC
到命令行并查看它是否根据需要更改结果。此外,原始答案包含一个拼写错误:
(额外的正斜杠字符)-sProcessColorModel=/DeviceGray
-sProcessColorModel=DeviceGray
(无正斜杠))You can use Ghostscript:
(example is for Windows; on Linux use
gs
instead ofgswin32c.exe
and\
as a line continuation mark instead of^
).Update
If color conversion does not work as desired and if you see a message like "Unable to convert color space to Gray, reverting strategy to LeaveColorUnchanged" then...
In this case add
-dOverrideICC
to the command line and see if it changes the result as desired.Also, the original answer contained a typo:
(additional forward slash character)-sProcessColorModel=/DeviceGray
-sProcessColorModel=DeviceGray
(no forward slash))