Metadata from EPS replace main pdfmark

Typesetting my documents with Heirloom Troff. I include various pictures in EPS format. The resulting main postscript file is finally converted to pdf with ps2pdf.

My document contains EPS created with ImageMagick, Inkscape and Graphviz. The following bug occurs with EPS from Graphviz only.

I set pdfmark metadata in my main file, but the metadata are replaced with those from Graphviz at ps2pdf stage. Thus the Title of my main pdf document becomes “G” instead of the initial title. The Creator becomes Graphviz instead of Heirloom Troff. I didn’t investigate for the Date but it probably is the date from one my Graphviz file also. Only the Author remains intact (probably not defined by Graphviz).

I don’t get the bug when embedding EPS created with ImageMagick or Inkscape.

Can you give an example file and the exact steps you followed to reproduce this?

My home network is currently broken. Not sure if I can provide a file before Monday.

In the meantime I noticed something more. The bug only occurs when several EPS are included on the same page. It is probably still a bug coming from Graphviz (rather than ps2pdf) since I have a page containing two EPS files coming from Inkscape and rsvg-convert and that page doesn’t break my metadata.

I tried removing additional Graphviz files in my document by keeping a single Graphviz picture on each page, and the metadata are fine, but as soon as a page contains two Graphviz EPS files, the pdfmark metadata get broken.

The ps/eps generated by Graphviz native drivers includes this:

% make sure pdfmark is harmless for PS-interpreters other than Distiller
/pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse
% make '<<' and '>>' safe on PS Level 1 devices
/languagelevel where {pop languagelevel}{1} ifelse
2 lt {
    userdict (<<) cvn ([) cvn load put
    userdict (>>) cvn ([) cvn load put
} if

This was written a very very long time ago. Maybe it’s unnecessary, or wrong.

Hi, sorry for this late answer. Here are my two files. Both are created with Heirloom troff.

The first file contains one picture from graphviz, and ps2pdf converts it to pdf by keeping the expected metadata. The Title is not set here, but the “Creator” is expected to be:

Heirloom Documentation Tools - dpost 8.77 (gritter) 6/19/11

The second file contains three pictures (I think the bug occurs when at least two graphviz pictures are on the same page). Now, ps2pdf adds a title from graphviz (which is “G”) and changes the Creator to Graphviz. (33.4 KB) (20.9 KB)