how to print a PDF document together with its filename in its upper left corner?

This is only a very special case of “how to add text given on the command line to a PDF file?

If I don’t find a nice and read utility to do this,

  • I will create an image file from the PDF file,
  • I will create another image file from that text string (ImageMagick, GraphicsMagic?!?),
  • and I will finally overlay them (ImageMagick, GraphicsMagic?!?).
PDF Hacks‘ Hack# 90 describes how to “Superimpose PDF Pages“; there is also a one-liner with pdftk for that:
$ pdftk mydoc.pdf output mydoc.marked.pdf background watermark.pdf
 
I need to print like 200 rather similar (1-page) files, which look rather, rather similar, and I don’t want to guess the filename from the contents of the page, so I prefer to print the filename on the same page as the actual contents.

 

Update 2011-07-04:
I am using text2pdf (a rather, rather simple tool) for this task (regard this as one logical line):

$ echo “text to be printed into the upper left corner” | /usr/local/text2pdf/text2pdf -A4 -s10 -v12 | pdftk original_file output file_with_sth_in_its_upper_left_corner background –


Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.