我一直在命令行中使用 Ghostscript
gswin64c sDEVICE=pdfwrite -o out.pdf in.pdf
很长一段时间以来,取得了巨大的成功。 Ghostscript 的位置已添加到 Windows 10 中的 Path 变量设置中。今天它突然停止工作,并给出以下错误消息:
GPL Ghostscript 9.55.0 (2021-09-27)
Copyright (C) 2021 Artifex Software, Inc. All rights reserved.
This software is supplied under the GNU AGPLv3 and comes with NO WARRANTY:
see the file COPYING for details.
Error: /undefinedfilename in (sDEVICE=pdfwrite)
Operand stack:
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push
Dictionary stack:
--dict:762/1123(ro)(G)-- --dict:0/20(G)-- --dict:75/200(L)--
Current allocation mode is local
Last OS error: No such file or directory
GPL Ghostscript 9.55.0: Unrecoverable error, exit code 1
到目前为止我已经尝试过
- 将 Ghostscript 从 9.54 更新到 9.55.0
- 不同的输入文件
- 重命名输入文件
- 包含输入文件的不同文件夹
- 将输入文件复制到\gs9.55.0\bin\文件夹
- 使用管理员权限运行命令行
- 以管理员身份登录运行窗口
一切都没有成功,并且总是给我同样的错误消息。所有尝试过的文件都可以在任何 pdf 查看器中正确显示。
我在这里做错了什么?为什么突然?
最佳答案
很容易完成,但读取错误undefinedfilename in (sDEVICE=pdfwrite)
虽然不是很清楚,但它认为您正在要求处理该文件。
但是,您应该像 -o 输出文件开关一样添加开关 - 信号。
如果没有 IN 文件,消息就会更改
gswin64c -sDEVICE=pdfwrite -o out.pdf in.pdf
GPL Ghostscript 9.55.0 (2021-09-27)
Copyright (C) 2021 Artifex Software, Inc. All rights reserved.
This software is supplied under the GNU AGPLv3 and comes with NO WARRANTY:
see the file COPYING for details.
错误:(in.pdf) 中的/undefinedfilename
Operand stack:
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push
Dictionary stack:
--dict:764/1123(ro)(G)-- --dict:0/20(G)-- --dict:75/200(L)--
Current allocation mode is local
Last OS error: No such file or directory
GPL Ghostscript 9.55.0: Unrecoverable error, exit code 1
顺便说一句,如果您养成使用习惯,有时可以减少以后的问题
gswin64c -sDEVICE=pdfwrite -o"out.pdf"-f"in.pdf"
关于pdf - 我在 gswin64c sDEVICE=pdfwrite 中做错了什么吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69896246/