Silent printing of a PDF in Python

I suggest you install GSView and GSPrint and shell out to gsprint.exe to print the pdf.

p = subprocess.Popen([r"p:\ath\to\gsprint.exe", "test.pdf"], 
                     stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = p.communicate()
print stdout
print stderr

I have used this in a industrial label printing solution, works great.

When the gsprint.exe program exits (i.e. after the call to communicate), you can delete the pdf file.

Leave a Comment