Home > best practices > Stamp Papers with Their Citation

## Stamp Papers with Their Citation

Wouldn’t it be convenient if the citation of the paper was available as part of the pdf document? You wouldn’t have to google for the information.

We can do so with the help of a simple perl script — the stamp is formatted using latex and is integrated with the original document to generate another version that has the stamp at the top of the page.

Below is a snapshot of document that was stamped using this script. Note the publication venue, location, month and year of publication at the top of the paper. The pdf is available here.

Here is the script:

#!/usr/bin/perl

$numArgs =$#ARGV + 1;
if($numArgs != 3){ print "Usage: ./stamp.pl <input pdf> <output pdf> \"year etc.\"\n"; exit; }$input_pdf = $ARGV[0];$output_pdf = $ARGV[1];$text = <<END
\\documentclass[letter]{article}
\\usepackage{fancyhdr}
\\pagestyle{fancy}
\\begin{document}
%\\fancyhead[CO,CE]{\\protect \\centering $ARGV[2]} \\centering$ARGV[2]
\\fancyfoot[c]{}
\\end{document}
END
;

open TEX_OUT, '>stamp.tex';
print TEX_OUT $text; close TEX_OUT; system('pdflatex stamp.tex'); system("pdftk$input_pdf stamp stamp.pdf output \$output_pdf");