try to decrypt pdf with empty password if its encrypted
This commit is contained in:
parent
9304d14c5f
commit
c6c8e0dc8a
1 changed files with 3 additions and 1 deletions
|
@ -101,12 +101,14 @@ def info(pdf):
|
||||||
try:
|
try:
|
||||||
pdfreader = PdfFileReader(fd)
|
pdfreader = PdfFileReader(fd)
|
||||||
data['pages'] = pdfreader.numPages
|
data['pages'] = pdfreader.numPages
|
||||||
|
if pdfreader.getIsEncrypted():
|
||||||
|
pdfreader.decrypt('')
|
||||||
info = pdfreader.getDocumentInfo()
|
info = pdfreader.getDocumentInfo()
|
||||||
if info:
|
if info:
|
||||||
for key in info:
|
for key in info:
|
||||||
if info[key]:
|
if info[key]:
|
||||||
data[key[1:].lower()] = info[key]
|
data[key[1:].lower()] = info[key]
|
||||||
xmp =pdfreader.getXmpMetadata()
|
xmp = pdfreader.getXmpMetadata()
|
||||||
if xmp:
|
if xmp:
|
||||||
for key in dir(xmp):
|
for key in dir(xmp):
|
||||||
if key.startswith('dc_'):
|
if key.startswith('dc_'):
|
||||||
|
|
Loading…
Reference in a new issue