From: "Harald Stürzebecher" <harald.stuerzebecher@gmail.com>
> Seems like this would be simple. I'm trying to programmatically redirect
> print to a different hardcoded printer.
>
> prt = r'\\front2\HP LaserJet 1022n'
> copies = 2
> printout = wx.html.HtmlPrintout()
> printout.SetHtmlText(html)
> data = wx.PrintDialogData()
> data.GetPrintData().SetNoCopies(copies)
> data.GetPrintData().SetPrinterName(prt)
> printer = wx.Printer(data)
> result = printer.Print(None, printout, False)
> err = printer.GetLastError()
>
> It's always returning False in 'result'. And it takes a long time to
> return the 'result'. I'm certain the 'prt' string is correct. (Or is there
> some way to get a list of the valid printers?)Are you really certain?
I added
data.GetPrintData().SetPrinterName('Fax')
to OnPrintSetup (line 130) in PrintFramework (wxPython Demo Version 2.6.0.0)
Starting the demo and clicking "Print Setup" correctly shows "Fax" as
the selected Printer.The unmodified demo shows my standard printer.
I think the function expects one of the local printer names that
appear in "Start -> Settings -> Printers" instead of a network
resource.
That wouldn't be a surprise. But the UNC string above is what came from
data.GetPrintData().GetPrinterName()
So if it's wrong, then wxWidgets is wrong too.
I'll try it later.
Michael
···
2006/6/22, Michael Hipp <michael@hipp.com>: