dont fail parsing parts of the pdf

This commit is contained in:
j 2016-01-25 15:51:54 +05:30
parent bfa29b469d
commit c03f72b47c

View file

@ -131,7 +131,10 @@ def info(pdf):
toc = parse_tableofcontents(pdfreader)
if toc:
data['tableofcontents'] = toc
info = pdfreader.getDocumentInfo()
try:
info = pdfreader.getDocumentInfo()
except:
info = None
if info:
for key in info:
if info[key]:
@ -144,8 +147,10 @@ def info(pdf):
data[key[1:].lower()] = value
except:
pass
xmp = pdfreader.getXmpMetadata()
try:
xmp = pdfreader.getXmpMetadata()
except:
xmp = None
if xmp:
for key in dir(xmp):
if key.startswith('dc_'):