How to prepend a PDF to a bunch of other PDFs

Dear Reader,

Imagine that you are entering a brave new world where marking is being doing using PDF submissions, Xournal and one of those tablet input pens.  In order to give out only one document to the students you think it is a good idea to prepend the marking and feedback matrix to your student’s PDF submissions.

Using the excellent pdftk software and some bash scripting this can be done easily.  Observe:

#!/bin/bash
# puts marking matrix in front of PDF for all PDFs in a directory

if [ -z “$1” ]; then
echo usage: $0 markingmatrix.pdf
exit
fi

MATRIX=$1

for FILENAME in $( ls *.pdf)
do
pdftk $MATRIX $FILENAME cat output matrix_$FILENAME
done
rm matrix_$MATRIX

This doesn’t of course solve the problem of your feedback looking like it was written by a three year old since the tablet is the size of a postcard and your screen is considerably bigger…. however it does make the electronic marking process a bit easier.

Advertisements

One thought on “How to prepend a PDF to a bunch of other PDFs

  1. Pingback: Electronic Marking using a Tablet Input Device « Software Configuration Tips from an Idiot

Leave a Reply

Fill in your details below or click an icon to log in:

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