I\'m trying to print a pdf file from Python with module win32print
but the only way I can print success is a text.
hPrinter = win32print.OpenPri
This is the code I have used and it works correctly.
name = win32print.GetDefaultPrinter() # verify that it matches with the name of your printer
printdefaults = {"DesiredAccess": win32print.PRINTER_ALL_ACCESS} # Doesn't work with PRINTER_ACCESS_USE
handle = win32print.OpenPrinter(name, printdefaults)
level = 2
attributes = win32print.GetPrinter(handle, level)
#attributes['pDevMode'].Duplex = 1 #no flip
#attributes['pDevMode'].Duplex = 2 #flip up
attributes['pDevMode'].Duplex = 3 #flip over
win32print.SetPrinter(handle, level, attributes, 0)
win32print.GetPrinter(handle, level)['pDevMode'].Duplex
win32api.ShellExecute(0,'print','manual1.pdf','.','/manualstoprint',0)