I'm new to Python and wxwidgets. I want to directly print some simple
lines of text to default (dot-matrix) printer *without print dialog*.
I searched web and lists and read some things about wxHtmlPrintout.
But I can't found or write a working code. How can I do this job
platform independently?
I'm new to Python and wxwidgets. I want to directly print some simple
lines of text to default (dot-matrix) printer *without print dialog*. I searched web and lists and read some things about wxHtmlPrintout.
I haven't done it, but from what I read in 'wxPython In Action', it appears it should be no problem to use the HTML print without first showing the print dialog. This may be the simplest way to do it in a platform independent manner.
Note that a few days ago I tried (on Windows) to do simple line mode printing by opening the printer port directly. Did not work at all, evidently Python does not know about Windows/DOS devices.
I haven't done it, but from what I read in 'wxPython In Action', it appears it
should be no problem to use the HTML print without first showing the print
dialog. This may be the simplest way to do it in a platform independent manner.
Previously I found a reply in a list to same question which suggest to
using HtmlPrintout instead of HtmlEasyPrinting class. But I can't
imagine how to print with HtmlPrintout? I'm tried simply convert
easyhtmlprinting example (from wxWiki) but naturaly it didn't work.
Can you write a code snippet from book?
I'm newly switched from PHP to Python (and partly to desktop
programing) and I'm realy missing PHP's user manual!
Thanks,
···
On 4/19/06, Michael Hipp <Michael@hipp.com> wrote:
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org
I'm new to Python and wxwidgets. I want to directly print some simple
lines of text to default (dot-matrix) printer *without print dialog*. I searched web and lists and read some things about wxHtmlPrintout.
But I can't found or write a working code. How can I do this job
platform independently?
Looks like wx.html.HtmlEasyPrinting doesn't give you the chance to deactivate the print dialog, as it always passes true to wx.Printer.Print...
You may instead be able to use the wx.html.HtmlPrintout directly, something like this:
printout = wx.html.HtmlPrintout()
printout.SetHtmlText(theText)
# (setup printout with fonts, headers, etc. as needed...)
Evren Esat OZKAN wrote:
> Hi,
>
> I'm new to Python and wxwidgets. I want to directly print some simple
> lines of text to default (dot-matrix) printer *without print dialog*.
> I searched web and lists and read some things about wxHtmlPrintout.
> But I can't found or write a working code. How can I do this job
> platform independently?
Looks like wx.html.HtmlEasyPrinting doesn't give you the chance to
deactivate the print dialog, as it always passes true to wx.Printer.Print...
You may instead be able to use the wx.html.HtmlPrintout directly,
something like this:
printout = wx.html.HtmlPrintout()
printout.SetHtmlText(theText)
# (setup printout with fonts, headers, etc. as needed...)
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org
I can't set paper size on Linux. But I think this a Cups/driver
problem because I can't set a custom paper size on any other app too.
Anyway I'm giving up for a while. (most of my customers will run this
app on Windows) For now I'm using HtmlPrintout() on Windows and raw
lpr output on Linux. I will test it with another Linux machine and/or
dot-matrix printer soon.
Thanks again.
···
On 4/20/06, Robin Dunn <robin@alldunn.com> wrote:
Evren Esat OZKAN wrote:
> Thanks, it's worked. But how can I set paper size. It's overriding
> printers default page size to A4 (or something like that) on Windows.
>
> printout = wx.html.HtmlPrintout()
> printout.SetHtmlText('aaaaa<br>aaaa')
> data = wx.PrintDialogData()
> data.SetAllPages(True)
> printer = wx.Printer(data)
> printer.Print(self, printout, False)
>
Try adding
data.GetPrintData().SetPaperId(wx.PAPER_LETTER)
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org