|
|
|
@ -76,14 +76,21 @@ def isencrypted(pdf_name):
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
True if encrypted, otherwise False
|
|
|
|
|
|
|
|
|
|
Raises:
|
|
|
|
|
AttributeError if pdf info cannot be obtained
|
|
|
|
|
"""
|
|
|
|
|
pdf_info = pdfinfo(pdf_name)
|
|
|
|
|
status = pdf_info['Encrypted'].split(' ')[0]
|
|
|
|
|
|
|
|
|
|
if status == 'yes':
|
|
|
|
|
return True
|
|
|
|
|
else:
|
|
|
|
|
return False
|
|
|
|
|
try:
|
|
|
|
|
pdf_info = pdfinfo(pdf_name)
|
|
|
|
|
status = pdf_info['Encrypted'].split(' ')[0]
|
|
|
|
|
if status == 'yes':
|
|
|
|
|
return True
|
|
|
|
|
elif status == 'no':
|
|
|
|
|
return False
|
|
|
|
|
else:
|
|
|
|
|
raise ValueError
|
|
|
|
|
except (SyntaxError, KeyError, ValueError):
|
|
|
|
|
raise AttributeError('Could not read pdf info.')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def pdf_unlock(pdf_file, overwrite=False):
|
|
|
|
|