Ghostscript, PDF/A: support pathlib

This commit is contained in:
James R. Barlow
2018-06-22 17:45:10 -07:00
parent 0aa51f0f3a
commit faaa4a1def
2 changed files with 5 additions and 3 deletions
+2 -2
View File
@@ -225,7 +225,7 @@ def generate_pdfa(pdf_pages, output_file, compression, log,
"-dPDFACompatibilityPolicy=1",
"-sOutputFile=" + gs_pdf.name,
]
args_gs.extend(pdf_pages)
args_gs.extend(fspath(s) for s in pdf_pages) # Stringify Path objs
log.debug(args_gs)
p = run(args_gs, stdout=PIPE, stderr=STDOUT,
universal_newlines=True)
@@ -246,7 +246,7 @@ def generate_pdfa(pdf_pages, output_file, compression, log,
if p.returncode == 0:
# Ghostscript does not change return code when it fails to create
# PDF/A - check PDF/A status elsewhere
copy(gs_pdf.name, output_file)
copy(gs_pdf.name, fspath(output_file))
else:
log.error('Ghostscript PDF/A rendering failed')
raise SubprocessOutputError()