I am trying to print out a PDF file, but I do not know how to specify the Page Format. I want to print all of my PDFs in A5 Format. Can someone please help me?
# this code works and prints the PDF File, but not in the A5 Format
import subprocess
printer='MyPrinter' # name of the printer
pdffile=r"C:\Desktop\pdf_test\pdfFile.pdf" # path to PDF
acroread=r"C:\Program Files (x86)\Adobe\Acrobat 10.0\Acrobat\Acrobat.exe" # path to Acrobat Reader
# print the file
cmd='"%s" /N /T "%s" "%s"' % (acroread, pdffile, printer)
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr=proc.communicate()
exit_code=proc.wait()
Another way of printing the PDF File, no idea how to specify format here either.
import win32api
pdffile=r"C:\Desktop\pdf_test\pdfFile.pdf" # path to PDF
printer_name = 'MyPrinter' # name of the printer
out = '/d:"%s"' % (printer_name)
### print the PDF to the proper Printer
win32api.ShellExecute(0, "print", pdffile, out, ".", 0)