繁体   English   中英

ghostscript转换为pdf-a-icc文件正确吗?

[英]ghostscript converting to pdf-a - icc file correct?

我在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似乎与* .icc文件是否存在于运行ghostscript的目录中有关。

我在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 \\ Adob​​eRGB1998.icc中。

正斜杠无关紧要,Ghostscript可以像在这里一样在同一路径中处理任何一种或两种类型(尽管我同意至少坚持使用一种或另一种是明智的)。

实际的问题是它无法找到文件“ Adob​​eRGB1998.icc”(在PostScript中,undefinedfilename意味着解释器无法找到文件),而且没有看到PDFA_def.ps文件的内容,也无法确切地说出原因(因为该文件)在PDFA_def.ps中打开)

但是,有一种合理的猜测是,在一种情况下,您将从文件夹d:\\ my_ps_files执行Ghostscript,因此ICC配置文件在当前目录中,而在另一种情况下,您正在从“其他”目录中执行Ghostscript,因此该文件不在当前目录中。 显然,您在其中修改了文件名,因为它不是默认名称,但看起来您没有指定完整路径。

“在命令行中指定”是指完全不同的调用,在这种情况下,您使用AdobeRGB1998.icc作为OutputICCProfile,但是PDFA_def.ps需要使用它来设置OutputIntent字典中的DestOutptuProfile,这是一个完全不同,并且在命令行上指定。 这是因为无法在命令行上创建字典对象,因此必须在PostScript中完成,并且由于必须在PostScript中完成字典的创建,因此也必须创建其内容,其中之一是DestOutputProfile,由于是从文件中读取的,因此您也需要在PostScript中指定它。

您应该在PDFA_def.ps中为ICC配置文件添加完整的路径规范,而不是仅将其隐式保留为当前工作目录。

需要注意的是DestOutputProfile和OutputICCProfile是不同的东西,你不需要指定高电平输出一个OutputICCProfile,这对渲染控制,在这里有没有影响,我会放弃它。

在批处理文件中完全出现错误的原因是“>”是一个shell命令,因此,如果将其放在批处理文件中将无法工作,它将作为命令行参数传递给Ghostscript。 幸运的是,这是在处理完成后发生的,因此不会造成不良影响。 无论如何,它不会包含任何内容,因为您已将stdout重定向到文件。

除非您有充分的理由,而不仅仅是民俗(除非有充分的理由进行设置,但您似乎并没有以这种方式使用它),否则请不要设置-dNOOUTERSAVE。 除非适用某些特定条件,否则这样做只会导致处理速度减慢(由于与垃圾回收相关的复杂原因)。

暂无
暂无

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

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