【发布时间】:2016-11-17 15:22:44
【问题描述】:
我在 Windows 系统上使用 ghostscript 9.19。 当我从批处理文件运行 ghostscript 时,它会创建 pdf。 当从程序安排ghostscript时,它会创建一个没有内容的pdf - 只有一个空白页。 两种情况下的命令行都是一样的(一行很长,下面因为格式化分开了):
gswin32c.exe -sstdout=d:\my_data\gs_stdout.log
-dPDFA=1 -dBATCH -dNOPAUSE -dNOOUTERSAVE
-sColorConversionStrategy=/RGB
-sOutputICCProfile=d:\my_ps_files\AdobeRGB1998.icc
-sDEVICE=pdfwrite
-sOutputFile=d:\my_data\my_hopeful_pdfa_pdfa.pdf
-dPDFACompatibilityPolicy=1 "d:\my_ps_files/PDFA_def.ps" "d:\my_data\my_hopeful_pdfa_pdfa.ps"
> d:\my_data\my_hopeful_pdfa_gs_out.log
my_hopefule_pdfa_gs_out.log 永远不会被创建。但是 gs_stdout.log 确实被创建了。
是否创建 pdf 似乎与运行 ghostscript 的目录中是否存在 *.icc 文件有关。
我在 stdout.log 文件中得到不同的输出。
当它起作用时,我得到:
GPL Ghostscript 9.19 (2016-03-23)
Copyright (C) 2016 Artifex Software, Inc. All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Error: /undefinedfilename in (>)
Operand stack:
false
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push
Dictionary stack:
--dict:1201/1684(ro)(G)-- --dict:0/20(G)-- --dict:80/200(L)--
Current allocation mode is local
Last OS error: Invalid argument
失败时的错误日志是:
GPL Ghostscript 9.19 (2016-03-23)
Copyright (C) 2016 Artifex Software, Inc. All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Error: /undefinedfilename in --file--
Operand stack:
--nostringval-- --nostringval-- (AdobeRGB1998.icc) (r)
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1967 1 3 %oparray_pop 1966 1 3 %oparray_pop 1950 1 3 %oparray_pop 1836 1 3 %oparray_pop --nostringval-- %errorexec_pop .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval--
Dictionary stack:
--dict:1201/1684(ro)(G)-- --dict:0/20(G)-- --dict:79/200(L)--
Current allocation mode is local
Last OS error: No such file or directory
Current file position is 818
谁能帮我解释一下这个输出。 AdobeRGB1988.icc 在这两种情况下都驻留在命令行中指定的 d:\my_ps_files\AdobeRGB1998.icc 中。
【问题讨论】:
-
您在
/PDFA_def.ps处使用正斜杠,这不是普通的 Windows 路径分隔符。尝试用反斜杠替换它。另一点是,从程序启动时环境变量可能会有所不同,但不知道哪个程序以何种方式启动它,这很难说。
标签: pdf ghostscript