Clarified that both PDF and image files can be processed, additional sanity checking, better handling for image files with incorrect DPI settings.