Skip to main content
Inspiring
May 27, 2011
Question

How to pass PS header data to pdfmark?

  • May 27, 2011
  • 1 reply
  • 845 views

Hope this is the right place for this question:

I currently use a bit of PostScript in Distiller's epilogue.ps file to add my name as "Author" to all my PDFs as they are distilled:

[ /Author (My Name) /DOCINFO pdfmark

So far, so good.

Now what I want to do is automatically pass the data in the header of the PostScript file (such as %%Title, %% Creator) to the epilogue file.

e.g. something like this:

[ /Title TitleVariable /DOCINFO pdfmark

so that a .ps file with a header line

%%Title: My File.file

becomes a PDF file with Title: My File.file

Is this possible?

Hope this makes sense.

At the moment, the three "main" PDF metadata fields are always empty, and it's a pain having to fill them manually.

This topic has been closed for replies.

1 reply

Mr__Horton
Inspiring
May 27, 2011

I don't think that standard PostScript interpreters parse the comment lines automatically so that you would have populated variables/strings available to your PostScript program after the %%EndComments line. (maybe Dov Isaacs knows for sure).

One alternative would be to add at the end of your epiloque a procedure that reads lines in from "currentfile" as strings until "%%EndComments" is found and parses the strings (looking for strings that start with "%%Creator:", "%%Title", etc. and defining your own variables based on the value portion of the strings.

Redbook example of currentfile useage:

/str 100 string def

currentfile str readline

here is a line of text

pop /textline exch def

You would have to be a little bit fancier than this but I hope the concept makes sense.