Popular Posts

Tuesday, February 17, 2009

Adding PDF headers, footers, and watermarks in GNU/Linux

Recently I needed to add a header/footer to an existing PDF file. With some help from this link, I figured it out:
http://coding.derkeiler.com/Archive/Perl/comp.lang.perl.misc/2005-04/msg00151.html

First, use OpenOffice.org Writer (for example) to generate a single-page PDF file that has the needed header/footer/watermark.

Second, use pdftk's background option. Quoting from the man page of pdftk:

pdftk in.pdf background back.pdf output out.pdf

the back.pdf is the file you created that has the needed header/footer/watermark. The in.pdf is the file you need to apply header/footer/watermark to. The result, of course, is saved into out.pdf.

You can also use the dual option stamp instead of background. This will overlay the back.pdf on top of every page of in.pdf.

4 comments:

jobs in sales said...

very good article
jobsinsales

BioEng Student said...

Two points of follow-up, there is a very nice GUI front-end to pdftk under Windows: PDFTK Builder
http://angusj.com/pdftkb/

Also, there is a very interesting HowTo here about adding page numbers:
http://forums.debian.net/viewtopic.php?t=30598

Enjoy!

Shashi said...

Many thanks for the post! It helped me a great deal. :)

Tomek said...

thank you! this was exactly what I needed!