Tidied up PDF handling a bit. Added a test page for PDFs. Tidied up test page handling.