ghostscripts in python with watchdog

Bheesham Persaud me at bheesham.com
Fri Feb 14 01:26:13 EST 2020


Hey!

If you change the "-sOutputFile` parameter you pass into gswin64c.

For example, something like:

     output_directory = os.path.join(os.path.dirname(input_src), "out")

And then you should be able to modify the call to `os.system` to 
something like:

     os.system(
         "gswin64c -q -dBATCH -dNOPAUSE"
         "-sOutputFile={output_directory}/page{page:04d}.pdf"
         " -dFirstPage={page} -dLastPage={page}"
         " -sDEVICE=pdfwrite {input_pdf}"
         .format(
             page=i,
             input_pdf=input_pdf,
             output_directory=output_directory
         )
     )


More information about the Python-list mailing list