【问题标题】:The dictionary does not contain required key: Pages字典不包含必需的键:Pages
【发布时间】:2021-04-27 11:57:35
【问题描述】:

我正在尝试使用 PDFNetPython3 将 pdf 转换为 pdf/a。但是我收到以下错误。 主要错误信息: 字典不包含必需的键:Pages

根据 PDFNetPython3 文档。

from PDFNetPython3 import PDFNet, PDFACompliance
# ... some necessary code like temp_file_path_in (this is not null and has values of file_object)

pdf_a = PDFACompliance(True, tmp_file_path_in, None, PDFACompliance.e_Level2B, 0, 0, 10)

也试过用这个(得到同样的错误):

pdf_a = PDFACompliance(True, filename, None, PDFACompliance.e_Level2B, 0, 10)

我想知道这个页面是否与 pdf 页码或总页数有关。我正在将空白 pdf 页面与其他 pdf 页面合并并转换为 pdfa!

参考:https://www.pdftron.com/documentation/python/guides/features/pdfa/convert/

提前致谢!!!

【问题讨论】:

    标签: python-3.x pdfnet


    【解决方案1】:

    该异常表明您正在处理的文档不包含任何页面。由于您正在合并一个空白 PDF,您很可能错过了 PDFDoc.PagePushBack(page) call.

    如果这没有帮助,请分享您创建和合并 PDF 的代码。

    【讨论】:

    • 感谢您的回复。我会测试它并让你知道。我不知道 PagePushBack(Page) 也是必需的。
    猜你喜欢
    • 2011-02-12
    • 2014-09-24
    • 1970-01-01
    • 1970-01-01
    • 2011-01-12
    • 1970-01-01
    • 2013-11-30
    • 2012-12-08
    • 2021-01-21
    相关资源
    最近更新 更多