dont fail parsing parts of the pdf
This commit is contained in:
parent
bfa29b469d
commit
c03f72b47c
1 changed files with 8 additions and 3 deletions
|
@ -131,7 +131,10 @@ def info(pdf):
|
|||
toc = parse_tableofcontents(pdfreader)
|
||||
if toc:
|
||||
data['tableofcontents'] = toc
|
||||
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
|
||||
|
||||
try:
|
||||
xmp = pdfreader.getXmpMetadata()
|
||||
except:
|
||||
xmp = None
|
||||
if xmp:
|
||||
for key in dir(xmp):
|
||||
if key.startswith('dc_'):
|
||||
|
|
Loading…
Reference in a new issue