Added base code from http://www.ioslearner.com/generate-pdf-programmatically-iphoneipad/