Skip to main content
Oct 29, 2013 11:41 PM UTC
Question

When editing a postscript file, how can I add Document Properties "Subject" and "Keywords"?

Hi:

I am editing a postscript file.  I add some data to the .ps file so when the file is converted to a PDF file, some of the PDF's Document Properties are entered, and other variables are set. 

I can get the PDF Document Property "Author" in my resulting PDF file by adding this line to the .ps file - 

%%For: JohnB

When this line is added, and I convert the .ps file, the resulting PDF file has "JohnB" in its "Author" field. 

Now, I would like to edit my .ps file to have the PDF Document Properties "Subject" and "Keywords" added into the PDF file. 

I tried simply adding to the .ps file -

%%Subject: Birds

But this does not work. 

So what do I need to enter into the .ps file to give me the Document Properties "Subject" and "Keywords" in my PDF file? 

Thanks,

Kevin

This topic is closed to new replies. Start a new post to keep the conversation going.

9 replies

Participating Frequently
Oct 30, 2013 7:39 PM UTC

Try this:

%!

<<

/ProcessDSCComment {

  (%%Title:) anchorsearch {

    pop                         % Discard matching string

    [ /Title                    % set up pdfmark

    3 -1 roll /DOCINFO pdfmark

  }{

    (%%Creator:) anchorsearch {

    pop                         % discard matching string

    [ /Author                   % set up pdfmark

    3 -1 roll /DOCINFO pdfmark

    } {

      (Unrecognised DSC comment ) print print (\n) print

    } ifelse

  } ifelse

pop                             % Discard file arg

}

/ProcessComment {

pop                             % Discard comment

pop                             % Discard the file arg

}

>> setuserparams

%!PS-Adobe-2.0

%%Pages: 1

%%Title: PutTitleHere

%%Creator: PutCreatorHere

%EndComments

Translate
Oct 31, 2013 1:23 PM UTC

Your answer appears to only add "Title" and "Creator" into the .ps file.  But I already know how to add those in my postscript file.  As I mentioned, I need to edit the .ps file with entries to give me the Document Properties "Subject" and "Keywords" in the resulting PDF file. 

What can I enter into my postscript file to yield the "Subject" and "Keywords"  Document Properties in the resulting PDF file? 

Translate
Legend
Oct 31, 2013 1:44 PM UTC

That code looks as if it is supposed to set the properties in the PDF by using the pdfmark operator. Did you examine it in detail?

Translate