If you have a PDF file that doesn't have title, author, subject, and keywords set in it, you can add these in the PostScript file before creating the PDF, or later on, by massaging the PDF file itself. I learnt how to do so here. Basically, you need three things: a file containing the pdfmarks, a PDF file, and a copy of GhostScript. The pdfmarks file I used for the example above is:

[ /Title (Exim and LDAP)
  /Subject (Making Exim talk to an LDAP server)
  /Keywords(Exim, LDAP, Lotus Domino, ...)
  /Author (Jan-Piet Mens)
  /DOCINFO pdfmark

I then massaged those keywords into the final PDF with this tiny shell script:



gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite \
        -sOutputFile="${TMP}" "${IN}"  pdfmarks

mv "${TMP}" "${IN}"

Makes me happier. :-)

Flattr this
Linux, MacOSX, and CLI :: 08 Aug 2009 :: e-mail


blog comments powered by Disqus