#!/bin/sh -x

_file="${1%%.*}"
_ext="${1##*.}"
_out="/tmp/print-$(pwgen -1).ps"

convert_pdf() {
	pdf2ps "$_file.$_ext" "$_out"
}

case $_ext in
	[pP][dD][fF])
	convert_pdf; lpr $_out;
	;;
esac

rm -vf "$_out"
