pdfdetach: fix crash when getPage() returns null

Bug 85145
PDFDOC: Check for EOF when reading raw stream

Bug 85233
PDFDoc: fix crash when getPage() returns NULL

Bug 85235