Print without PrintDialog

Re: [wxPython-users] Show sizers

Hi,

Problem solved!

It was necessary to iniatialize the wx.PrintDialogData:

···

#------------------------------------------------------------------------

        def OnPrintClick(self, event):

                    pdata =

wx.PrintData()

                    pdata.SetPaperId(wx.PAPER_A4)

                    pdata.SetOrientation(wx.PORTRAIT)

                    pdata.SetQuality(600)

                    pdata.SetPrinterName('HP

LaserJet 4200 PS’)

                    data = wx.PrintDialogData(pdata)

                    data.SetToPage(1)

                    data.SetFromPage(1)

                    data.SetMaxPage(1)

                    data.SetMinPage(1)

                    printer =

wx.Printer(data)

                    printout =

MyPrintout()

                    if

printer.Print(self, printout, False):

                                data = printer.GetPrintDialogData()

                                pdata

= wx.PrintData(data.GetPrintData())

                    printout.Destroy()

#------------------------------------------------------------------------

Thanks anyway.

Antonio Barbosa


From: António Barbosa (GN/dpi)
[mailto:ab@globalnoticias.pt]
Sent: segunda-feira, 6 de Novembro
de 2006 21:32
To:
wxpython-users@lists.wxwidgets.org
Subject: [wxPython-users] Print
without PrintDialog

Hi,

I’m trying to print WITHOUT setup dialog (using system defaults) but
without sucess.

I am playing with the example from chapter 17 of THE
BOOK (wxpython in action):

  • If I use useSetupDialog = True, everything works ok.

  • If I use useSetupDialog = False, I get no errors but also NO OUTPUT.

Here wx 2.6 AND 2.7 on Windows.

TIA

Antonio Barbosa