无法加载PDF文档

时间:2018-03-16 19:43:19

标签: c++ pdf podofo

我对Ubuntu 17.10上的C ++中PoDoFo lib版本0.9.5有疑问。 我尝试通过扫描仪加载PDF扫描文档(使用非扫描文档,它可以正常工作),但加载文档时出现问题。

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());
    }
}

memDocumentPoDoFo::PdfMemDocument但是我抓住了这个警告并且根本没有加载文档(仍为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>>

有人有同样的问题吗?还是有什么想法?

1 个答案:

答案 0 :(得分:1)

警告信息

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>>

表示相关文档格式不正确:其对象交叉引用表包含15个条目,而文档预告片声明只有8个。

顺便说一下,警告中引用的预告片还包含一个损坏的ID:&#39;&gt;&#39;在第一个ID字符串的末尾缺失。

因此,PDF中似乎存在多个错误,导致PoDoFo无法加载它。

(Adobe Acrobat Reader在加载时忽略或修复PFD中的许多错误而不抱怨,因此您可能不会意识到所有这些缺陷。)

相关问题