GhostScript: Bug under High Sierra setting PDF Metadata?

时间:2018-02-03 10:43:07

标签: shell unix pdf ghostscript

Can anyone confirm the following behaviour on MacOS 10.13 High Sierra with GhostScript? I don't get the problem when using 10.12 Sierra.

When I create PDFs in GhostScript, it always leaves the Title, Author and other metadata blank.

I know that you can set the metadata with PDFmarks within the PostScript file itself (or a secondary merged PS file that just contains PDFmarks), but that requires manually setting the field for each file.

Currently, my PDFs fail PDF-X validation until I manually add the metadata.

My PostScript does contain DSC comments, and the GS documentation implies that this should be picked up, as ParseDSCCommentsForDocInfo is true by default.

/usr/local/bin/gs \
    -dPDFX \
    -dNOPAUSE \
    -dBATCH \
    -sDEVICE=pdfwrite \
    -sOutputFile="$filename" \
    -dProcessColorModel=/DeviceCMYK \
    -dCompatibilityLevel=1.4 \
    "$f" \
    /Library/PostScript/PDFX_def.ps

The source of the PostScript does not seem to be a factor: Adobe apps like InDesign, MacOS's cgpdftops, all behave similarly.

Here's a simple test PS file. Distiller takes the comments and uses them for DocInfo; GhostScript doesn't on MacOS 10.13.

%!PS-Adobe-3.0
%%Title: (MyTitle.file)
%%Creator: (MyApp: cgpdftops CUPS filter)
%%CreationDate: (Saturday, February 03 2018 10:19:01 GMT)
%%For: (User Me)
%%BoundingBox: 36 36 576 756
%%Pages: 1
%%LanguageLevel: 2
%%EndComments
%%BeginSetup
% this is where fonts would be embedded
%%EndSetup
%%Page: (1) 1
%%BeginPageSetup
% this is where page-specific features would be specified
%%EndPageSetup
% Draw a black box around the page
0 setgray
1 setlinewidth
36 36 540 720 rectstroke

% Draw a two inch blue circle in the middle of the page
0 0 1 setrgbcolor
306 396 144 0 360 arc closepath fill

% Draw two half inch yellow circles for eyes
1 1 0 setrgbcolor
252 432 36 0 360 arc closepath fill
360 432 36 0 360 arc closepath fill

% Draw the smile
1 setlinecap
18 setlinewidth
306 396 99 200 340 arc stroke

% Print it!
showpage
%%EOF

1 个答案:

答案 0 :(得分:0)

从MacOS Mojave 10.14.3和GhostScript版本9.26开始,此问题现已修复。我只能假定这是GhostScript或MacOS中的错误。