#!/bin/sh input=$1 watermark=$2 output=$3 abl=/tmp/all_but_first.pdf first=/tmp/first.pdf first_stamped=/tmp/first_stamped.pdf # detach pdftk $1 cat 2-r1 output $abl pdftk $1 cat 1 output $first #Stamp pdftk $first stamp $watermark output $first_stamped #Attach pdftk $first_stamped $abl cat output $output