|
|
@ -56,8 +56,14 @@ def pdf_unlock(pdf_file, overwrite=False):
|
|
|
|
if input_name.endswith(suffix):
|
|
|
|
if input_name.endswith(suffix):
|
|
|
|
return
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
# save as temporary file
|
|
|
|
# Get name of Ghostscript executable
|
|
|
|
cmd_str = ('gs '
|
|
|
|
if os.sys.platform == 'win32':
|
|
|
|
|
|
|
|
exec_name = 'gswin64c'
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
exec_name = 'gs'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Create Ghostscript command string
|
|
|
|
|
|
|
|
cmd_str = ('{} '
|
|
|
|
'-dSAFER '
|
|
|
|
'-dSAFER '
|
|
|
|
'-dNOPAUSE '
|
|
|
|
'-dNOPAUSE '
|
|
|
|
'-dQUIET '
|
|
|
|
'-dQUIET '
|
|
|
@ -65,7 +71,7 @@ def pdf_unlock(pdf_file, overwrite=False):
|
|
|
|
'-sPDFPassword= '
|
|
|
|
'-sPDFPassword= '
|
|
|
|
'-sDEVICE=pdfwrite '
|
|
|
|
'-sDEVICE=pdfwrite '
|
|
|
|
'-sOutputFile="{}.pdf" '
|
|
|
|
'-sOutputFile="{}.pdf" '
|
|
|
|
'"{}.pdf"').format(output_name, input_name)
|
|
|
|
'"{}.pdf"').format(exec_name, output_name, input_name)
|
|
|
|
|
|
|
|
|
|
|
|
with subprocess.Popen(
|
|
|
|
with subprocess.Popen(
|
|
|
|
cmd_str, stdout=subprocess.PIPE, bufsize=1,
|
|
|
|
cmd_str, stdout=subprocess.PIPE, bufsize=1,
|
|
|
|