|
|
|
@ -76,14 +76,21 @@ def isencrypted(pdf_name):
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
True if encrypted, otherwise False
|
|
|
|
|
|
|
|
|
|
Raises:
|
|
|
|
|
AttributeError if pdf info cannot be obtained
|
|
|
|
|
"""
|
|
|
|
|
try:
|
|
|
|
|
pdf_info = pdfinfo(pdf_name)
|
|
|
|
|
status = pdf_info['Encrypted'].split(' ')[0]
|
|
|
|
|
|
|
|
|
|
if status == 'yes':
|
|
|
|
|
return True
|
|
|
|
|
else:
|
|
|
|
|
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):
|
|
|
|
|