[reportlab-users] Changing printer
Jade Meskill
reportlab-users@reportlab.com
11 Feb 2003 14:11:55 -0700
Darryl,
You can do something like this using DDE and Acrobat on Windows, for
*nix I just os.spawn*() and pass lpr the correct paramaters:
## BEGIN SAMPLE CODE
## NOT TESTED AND OFF THE TOP OF MY HEAD
## BUT SHOULD WORK
import win32ui
import dde
s = dde.CreateServer()
s.Create('')
c = dde.CreateConversation(s)
c.ConnectTo('acroview', 'control')
# driverName is optional (I think)
c.Exec('[FilePrintTo("%s", "%s", "%s", "%s")]' % (filename, printerName,
driverName, portName))
s.Destroy()
## END SAMPLE CODE
I wish there was a better way to do this, but this is the best I could
find. Be careful using DDE to batch print, as Acrobat seems to get
overwhelmed and will start throwing up errors...
-Jade
On Tue, 2003-02-11 at 02:58, Darryl Whiteside wrote:
> Hi,
>
> Is it possible to change the printer associated with a document from
> the python script that created it. We are creating three different
> documents from different python scripts and each one needs to go to a
> different printer. It is laborious to have to change it for each one
> before printing.
>
> Thanks,
>
> Darryl
>
> Darryl
> Whiteside Mob. 0413 586 031
> Technical Manager
> Optimus Management Information Systems Pty Ltd
> Ph. (07) 3510 2106
> Suite 11, Highpoint Corporate
> Centre Fax. (07) 3366 9344
> 240 Waterworks Road Email. d.whiteside@optimus2020.com
> Ashgrove QLD 4060 Website. www.optimus2020.com