我正在使用 Ghostscript 将 PDF 转换为 PDF/A 文件,效果很好。我想使用该-dSAFER
选项,强制我在文件中对 ICCProfile 使用绝对路径名PDFA_def.ps
:
% in the current directory unless the user modifies the corresponding line below.
% Define entries in the document Info dictionary :
[ /Title (Title) % Customise
/DOCINFO pdfmark
% Define an ICC profile :
/ICCProfile (/var/www/myproject/gs/sRGB2014.icc) % Customise
def
[/_objdef {icc_PDFA} /type /stream /OBJ pdfmark
使用以下命令,我可以使用 GhostScript 转换 PDF:
gs --permit-file-read=/var/www/myproject/gs/ \
-dPDFA=3 \
-dBATCH \
-dNOPAUSE \
-dSAFER \
-sColorConversionStrategy=RGB \
-sDEVICE=pdfwrite \
-sOutputFile=output.pdf \
/var/www/myproject/gs/PDFA_def.ps \
input.pdf
因为这个项目在生产时被转移到不同的文件夹中,所以我正在寻找一种使路径名可配置的方法。因为-dSAFER
我们必须使用绝对路径名,我想。顺便说一下,我是一名 PHP 开发人员,但我对 PostScript 一无所知。
有没有办法将路径传递/var/www/myproject/gs/
到 PostScript 文件中PDFA_def.ps
(这对我来说就足够了)。
使用
-sname=string
命令行选项,您可以在 systemdict 中定义一个名称,并使用给定的字符串作为值,并在 PostScript 代码中使用该名称。例如,如果您gs
使用然后您可以在 PDFA_def.ps 中使用该名称