【发布时间】:2013-03-28 02:41:16
【问题描述】:
我有一个破坏 pyPdf 的 pdf 文件:http://tovotu.de/tests/test.pdf
这是示例脚本:
from pyPdf import PdfFileWriter, PdfFileReader
outputPdf = PdfFileWriter()
inpdf = open("test.pdf","rb")
inputPdf = PdfFileReader(inpdf)
[outputPdf.addPage(x) for x in inputPdf.pages]
with open("output.pdf","wb") as outpdf:
outputPdf.write(outpdf)
错误输出在这里:http://pastebin.com/0m38zhjQ
使用来自 GitHub 的 PyPDF2 时,错误是相同的。 pdftk 可以像处理任何其他 pdf 一样处理此 pdf。请注意,写入失败,但读取似乎工作正常!
您能否至少指出导致该错误的 pdf 的确切部分?解决方法会更好:)
【问题讨论】:
-
我尝试下载 PDF,但该服务将我从一个不需要的文件赶到下一个。
-
好的,我把链接改成了更直接的东西。
标签: python pdf decode utf-16 pypdf