I have a question about PoDoFo lib version 0.9.5 in C++ on Ubuntu 17.10. I try to load PDF scanned document by scanner (with non-scanned docs, it works properly), but there is problem with loading a document.
pdf::Document::Document(const std::string &fname) {
try {
memDocument.Load(fname.c_str());
LTRACE << "created pdf::Document from file";
} catch (const PoDoFo::PdfError &error) {
LERROR << "Error while loading PDF document(" << fname << "): " << PoDoFo::PdfError::ErrorMessage(error.GetError());
}
}
memDocument
is PoDoFo::PdfMemDocument
but I catch this Warning and document isn't loaded at all (still null ref of memDocument
):
WARNING: There are more objects (15) in this XRef table than specified in the size key of the trailer directory (8)!
<</ID[<DC15F9B0B1D5684CB68315FC2D09425E<DC15F9B0B1D5684CB68315FC2D09425E>]/Info 7 0 R/Root 9 0 R/Size 8>>
Have somebody had same problem? Or any ideas?
The warning message
WARNING: There are more objects (15) in this XRef table than specified in the size key of the trailer directory (8)!
<</ID[<DC15F9B0B1D5684CB68315FC2D09425E<DC15F9B0B1D5684CB68315FC2D09425E>]/Info 7 0 R/Root 9 0 R/Size 8>>
indicates that the document in question is not well-formed: Its object cross reference table contains 15 entries while the document trailer declares that there are only 8.
By the way, the trailer quoted in the warning also contains a broken ID: The '>' at the end of the first ID string is missing.
Thus, there appear to be multiple errors in the PDF which keep PoDoFo from loading it at all.
(Adobe Acrobat Reader ignores or repairs many errors in PFDs while loading without complaining, so you might not be aware of all those defects.)