#!/usr/bin/bash

propers=${1:?Please choose propers PDF.}

if [ ! -e $propers ]
then
	echo $propers" does not exist."
fi

echo "Check if propers PDF is correct, then quit Okular."
okular $propers > /dev/null 2>&1

echo "Download Communion PDF to ~/Downloads/"
echo "(Make sure it is the only PDF there.)"
firefox "http://www.ccwatershed.org/goupil/"
read -p "Press enter to continue."

pdftk $propers ~/Downloads/*.pdf cat output tmp.pdf

echo "Check if combined PDF is correct."
okular tmp.pdf > /dev/null 2>&1

read -p "Press enter to print."
lpr -o number-up=2 -#8 tmp.pdf
echo "Printing communion verses…"

#lpr -o number-up=2 -#8 tmp.pdf
#lpr -o page-ranges=1 -o number-up=2 -#8 tmp.pdf
#read -p "Turn pages to print on back, then press enter."
#lpr -o page-ranges=2 -o number-up=2 -#8 tmp.pdf
#lpr -o page-ranges=3 -o number-up=2 -#8 tmp.pdf

rm tmp.pdf ~/Downloads/*.pdf
