Hi all,
I have started looking into the question of printing from my accounting
application.
My first attempt uses the printing framework that is part of
wxWindows/wxPython, as this seems to be the generic wx approach. I am using
two printers for testing - an HP LaserJetIIIP using PCL5, and a C-Itoh
dot-matrix printer. This is my initial test, just to see what would happen.
def OnPrintPage(self, page):
dc = self.GetDC()
dc.DrawText('This is line 1',100,100)
dc.DrawText('This is line 2',200,200)
return True
My first impressions are that printing under MSW works pretty well - there
some oddities with font sizes on the HP, but I imagine that I can find
solutions to this. However, printing under Linux (Redhat 9) does not work at
all. My guess is that this is because my printers are not equipped for
PostScript.
If I run the above program on the HP, I get two tiny dotted lines where the
text should be. If I run it on the dot-matrix, I get eight and a half pages
of text, which seems to be the PostScript output. If I print the sample
PrintFramework page from the demo using the HP, the images appear correctly,
but none of the text appears at all. I did not attempt this with the
dot-matrix.
Another problem with Linux is that the PrintDialog does not give the option
to select a printer.
I can foresee a long period of trial and error ahead, so I would appreciate
any advice that will point me in the right direction.
These are the printing capabilities that I think I will require. Please add
to the list if there are other things that I should be catering for.
- I must support a wide range of printers, including laser, inkjet,
dot-matrix, label printers, barcode printers, thermal slip printers, Windows
printers, etc.
- The most common requirement will be text-based columnar reports, which
could potentially run to 100's of pages. The ability to select certain
sections to print in bold, compressed, underlined, etc. would be nice.
- I need to print various forms - invoices, statements, remittance advices,
etc. These could be printed on pre-printed stationery, or the program must
draw the various horizontal and vertical lines, logos, images, etc, as
required.
- I will need to plot information, using bar charts, line graphs, pie
charts, etc.
- I will need to print images on text-based reports, such as pictures of
inventory items in a catalogue.
- Any report, once generated, must be able to be faxed, emailed, output as
HTML, copied to a spreadheet, etc, instead of being output to a printer.
This means that the generation of the report and the output of the report
must be split into separate functions in my application.
I am sure there are more, but this is enough for now.
I would prefer to standardise on one framework which will handle all these
requirements on both MSW and Linux. I quite like the wx printing framework,
so if it is possible to overcome my problems, I would be happy to stick with
it. Alternatively, I am aware of ReportLab and its pdf capability, but I
have not looked into it yet. I believe it has a fairly steep learning curve,
so I would appreciate some feedback before I venture down this path. Would
it be a viable solution?
Any comments or advice will be much appreciated.
Many thanks
Frank Millman