Added error checking to PDF creation functions.  Also added a getSuffix function to functions.php, as this bit of code is repeated in a few places.