I have installed ghostscript
and gsview
. After the installation there is available gsprint.exe
command which enables print a pdf
file programatically as follows:
from win32 import win32print
import subprocess
if __name__ == "__main__":
printer_name = "Microsoft Print to PDF"
print("Printer: %s" % (printer_name))
win32print.SetDefaultPrinter(printer_name)
p = subprocess.Popen([r"C:\Program Files\Ghostgum\gsview\gsprint.exe", r"C:\Users\xralf\Desktop\to_print\document1.pdf"],
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = p.communicate()
print (stdout)
print (stderr)
But it's impossible to use it, because ghostview needs registration number and registration numbers are
no longer available (according to their page). Do you know some alternative how to print pdf
file
programmatically in Windows 10?
The answer from here is obsolete now.