问题描述
我正在尝试使用 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,10)
也尝试使用这个(得到同样的错误):
pdf_a = PDFACompliance(True,filename,10)
我想知道此页面是否与 pdf 页码或总页数有关。我正在将空白 pdf 页面与其他 pdf 页面合并并转换为 pdfa !
参考:https://www.pdftron.com/documentation/python/guides/features/pdfa/convert/
提前致谢!!!
解决方法
异常表明您正在处理的文档不包含任何页面。由于您正在合并一个空白 PDF,因此您很可能错过了 PDFDoc.PagePushBack(page)
call.
如果这没有帮助,请分享您用于创建和合并 PDF 的代码。