Today's Random Photos:
René van Bevern
view out of a train window


The following shell script can be used to stamp PDF files with a headline. For example, like "Published in Proc. 9th LATIN, 2010". The script needs LaTeX and pdftk.

#!/bin/sh

if [ $# -ne 3 ]; then
    echo "Usage: $0 input.pdf 'text to stamp it with' output.pdf"
    exit 1
fi

INPUT="$1"
OUTPUT="$3"
TEXT="$2"
STAMP=pdfstamp.tex

cat <<EOF > "$STAMP"
\documentclass{article}
\begin{document}
\thispagestyle{empty}
\begin{center}
\raisebox{3cm}[4mm][2mm]{\sc
    $TEXT
}
\end{center}
\end{document}
EOF

pdflatex "$STAMP" && pdftk "$INPUT" background pdfstamp.pdf output "$OUTPUT"

rm "$STAMP" pdfstamp.pdf
}

© 2010 René van Bevern. Last modified 2010-03-23.