Printing Advice

Greetings,

First of all, the subject: Printing - as to a printer.

I had happily been writing invoice type forms using the win32ui (yeah, I know this is wx - I'm getting there ;-)) when I was issued a challenge - well two challenges.

1) I need to be able to print envelopes. Oops - this means landscape, which, believe it or not - doesn't seem to be that easy to coax out of win32ui, which doesn't matter because of...

2) Make it work with linux.

I don't mean to Whine about Wine, but that's about the only way win32ui is gonna work on Linux - and Wine and I aren't best friends.

So it's time to get seriously cross-platform. Besides, the GUI is already wxPython, so...

Objective:
User clicks [Print Envelope] button.
[OK] Dialogue pops up saying "Please Insert Envelope"
User inserts envelope.
User clicks [OK]
Envelope prints.

You'll notice there are no setup dialogues, and no printer dialogues in the desired workflow. Q1) Is it possible to work without these?

I also have concerns about the whole landscape issue. I played with the wxPython demo, and the PrintFramework dialogues appear to not work. A) they ignore my printer selection - the printout always goes to the default printer. B) They ignore the page orientation - it's always portrait. Tested on two physical printers, and one virtual PDF file printer, by sequentially making each one the default printer then restarting the demo. No Landscape.

Q2) Does this functionality exist in wxPython? Or is the demo code possibly just not setting these values somewhere?

The envelope printing thing (if I can get it to do landscape) looks like it could be done with wxHtmlEasyPrinting - but to get Linux compatability through the whole app, I'll have to rework the invoices - and they have some simple line drawing on them that I don't see a way to do in HTML.

At this point, Q3) I need advice - if there's any great documentation out there, I'm using the wrong google keywords.

Help?

Thanks,

Chris

···

_______________________________________________
Join Excite! - http://www.excite.com
The most personalized portal on the Web!

neptune321@excite.com wrote:

Objective: User clicks [Print Envelope] button. [OK] Dialogue pops up
saying "Please Insert Envelope" User inserts envelope. User clicks
[OK] Envelope prints.

You'll notice there are no setup dialogues, and no printer dialogues
in the desired workflow. Q1) Is it possible to work without these?

It can be a bit tricky, but it is possible. You need to set the values in the wx.PrintData and wx.PrintDialogData that would normally be set by the dialogs. Also there are [Get|Set]PrivData methods that will allow you to save or set some internal platform specific data that may have been set by prior print sessions. You may need to use the dialogs once as part of a setup procedure, to be able to select the printer and etc.

I also have concerns about the whole landscape issue. I played with
the wxPython demo, and the PrintFramework dialogues appear to not
work. A) they ignore my printer selection - the printout always goes
to the default printer. B) They ignore the page orientation - it's
always portrait. Tested on two physical printers, and one virtual PDF
file printer, by sequentially making each one the default printer
then restarting the demo. No Landscape.

Q2) Does this functionality exist in wxPython? Or is the demo code
possibly just not setting these values somewhere?

It's working here (with 2.7, but I would expect 2.6 to work as well.)

At this point, Q3) I need advice - if there's any great documentation
out there, I'm using the wrong google keywords.

There's a chapter in the book about the print framework:

http://wiki.wxpython.org/index.cgi/wxPythonInAction

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!