Inserting headers and footers onto an existing PDF document using pdflatex

When printing PDF documents it can often be useful to add a few quick notes to the document to help you remember context on the day you chose to print it. This is especially true as a reviewer of academic papers, where a submitted paper needs to be identified as such, with its ID number from the reviewing system, etc.

I recently discovered the pdfpages LaTeX package, which enables the \includepdf command to include an arbitrary selection of pages from an existing PDF into the resulting PDF. This makes it possible to throw together a .tex document in less than 10 lines that can do exactly what I want.

I went ahead and scripted this using python, available here:
https://github.com/jonmccune/annotate-pdf-hf

Usage:
$ ./annotate-pdf-hf.py -h
usage: annotate-pdf-hf.py [-h] -i INFILE [-l LHEAD] [-c CHEAD] [-r RHEAD]
[-f LFOOT] [-o RFOOT]

Magic header/footer annotation inserter

optional arguments:
-h, --help show this help message and exit
-i INFILE, --infile INFILE
Input PDF File
-l LHEAD, --lhead LHEAD
Left Header
-c CHEAD, --chead CHEAD
Center Header
-r RHEAD, --rhead RHEAD
Right Header
-f LFOOT, --lfoot LFOOT
Left Footer
-o RFOOT, --rfoot RFOOT
Right Footer

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s