# 1 页码无法正确提取
Traceback (most recent call last):
File "C:\Users\RSH\Desktop\PY\wordhelper\wordtopdf.py", line 219, in <module>
outpath = getPdfOutlines(testpath,targetpath)
File "C:\Users\RSH\Desktop\PY\wordhelper\wordtopdf.py", line 172, in getPdfOutlines
mylist = getOutline(outlines,isList) #递归获取大纲
File "C:\Users\RSH\Desktop\PY\wordhelper\wordtopdf.py", line 196, in getOutline
returnlist.append( o.get('/Title') + "\t\t" + str(o.get('/Page')+1) + "\n") #页码提取不出来,是IndirectObject(132, 0)形式的对象
TypeError: unsupported operand type(s) for +: 'IndirectObject' and 'int'
# 2 转化后的PDF缺少EOF marker ,PdfFileReader读取是会发生错误,无法进行后续操作
Traceback (most recent call last):
File "C:\Users\RSH\Desktop\PY\wordhelper\wordtopdf.py", line 219, in <module>
outpath = getPdfOutlines(testpath,targetpath)
File "C:\Users\RSH\Desktop\PY\wordhelper\wordtopdf.py", line 167, in getPdfOutlines
doc = PdfFileReader(file) #创建pdf的reader对象
File "C:\Users\RSH\AppData\Local\Programs\Python\Python37\lib\site-packages\PyPDF2\pdf.py", line 1084, in __init__
self.read(stream)
File "C:\Users\RSH\AppData\Local\Programs\Python\Python37\lib\site-packages\PyPDF2\pdf.py", line 1696, in read
raise utils.PdfReadError("EOF marker not found")
PyPDF2.utils.PdfReadError: EOF marker not found
请问该如何处理?