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