views:

605

answers:

2

I'm trying to switch on and off the Rotate 180 degree setting for a HP Laser jet printer (4200/ 4350) using a duplexer unit.

The Business has a requirement to "print on both sides", for maximum control I'd like to be able to manipulate at print time (through print macros) whether or not duplex printing is enabled for each of the different types of document the business works with.

I can control the tray assignments, print order and switch duplexing on and off. However, cannot figure out how to control the rotation option (switch this on and off).

Any solutions available other than a blanket - enable this option on the print server for all documents/ users?

Much appreciated.

+1  A: 

Perhaps the HP duplex option can be controlled from:

Printer Object: Access 2003 VBA Language Reference (http://msdn.microsoft.com/en-us/library/aa223133(office.11).aspx)

More specifically:

Duplex Property (http://msdn.microsoft.com/en-us/library/aa195860(office.11).aspx)

Remou
+1  A: 

The COM interface is what you need. The python code for changing the tray is below: VB follows the same basic steps.

import win32print
PRINTER_DEFAULTS = {"DesiredAccess":win32print.PRINTER_ALL_ACCESS}
pHandle = win32print.OpenPrinter('PRINTERNAME', PRINTER_DEFAULTS)
properties = win32print.GetPrinter(pHandle, 2) #get the properties
pDevModeObj = properties["pDevMode"] #get the devmode
pDevModeObj.DefaultSource = tray_three #change some sort of setting... this case is the tray
properties["pDevMode"]=pDevModeObj #write the devmode back to properties
win32print.SetPrinter(pHandle,2,properties,0) #save the properties to the printer

Of course, you can probably just change printer settings through vba in word. If you are using excel or any other office product it will not work.

jle