I am trying to parse the bookmarks from a document x.pdf
This code results int he following error:
1 2 3 4 5 6 7 |
>>> import pyparsing as pp >>> import PyPDF2 >>> from PyPDF2 import PdfFileReader >>> pdfFileObj = open ( 'x.pdf' , 'rb' ) >>> PdfReader = PyPDF2.PdfFileReader(pdfFileObj) >>> pdfNestedExp = PdfReader.getOutlines() >>> print (pp.nestedExpr(opener = '{' , closer = '}' ).parseString(pdfNestedExp)) |
Error:Traceback (most recent call last):
File "<pyshell#57>", line 1, in <module>
print(pp.nestedExpr(opener='{', closer='}').parseString(pdfNestedExp))
File "C:\Python34\lib\site-packages\pyparsing.py", line 1620, in parseString
instring = instring.expandtabs()
AttributeError: 'list' object has no attribute 'expandtabs'
What am I doing wrong?