Hi all
I have now resumed looking into the PrintFramework, using 2.5.4.1 on Python
2.4. It is looking much better than it did a year ago.
I have found two bugs in GTK1/GTK2. I have found workarounds for both, but I
thought I would report them for the record.
1. According to the docs, a wx.Printdata object can be constructed by
passing it an existing wx.Printdata object as a parameter. The demo uses
this method to save printData before destroying the PrintDialog, as
follows -
self.printData = wx.PrintData(
printerDialog.GetPrintDialogData().GetPrintData() )
This works with MSW, but segfaults with GTK.
A simple way to test this is from the interpreter -
pd = wx.PrintData()
pd2 = wx.PrintData(pd)
This also segfaults.
I changed the demo to read as follows -
self.printData = printerDialog.GetPrintDialogData().GetPrintData()
This does not segfault. I have not checked to see if it actually saves the
correct data, but I would imagine that it does.
2. wx.Printout has a method GetPageInfo(), requesting (minPage, maxPage,
fromPage, toPage). If not overridden, it defaults to (1,32000,1,1). The
implication is that it starts counting from 1, and this is how MSW works.
GTK1/2 will not print unless minPage and fromPage are set to 0. Then it will
only print the first page, regardless of maxPage or toPage.
The workaround is to call PrintDialogData.SetFromPage() and SetToPage(). GTK
then refers to these values, and ignores the values in GetPageInfo().
Apart from these, my main problem so far is that, testing with my HPIIIP
printer, wx.PrinterDC on MSW uses a PPI of (300,300), while wx.PostScriptDC
on GTK uses a PPI of (72,72), so it is difficult to set up a report that
prints correctly on both platforms. Setting a UserScale factor helps to an
extent, but it does not adjust font sizes in the correct ratio, so this has
to be done separately. I am still playing with this and trying to find a
generic solution, but I thought I would mention it here to see if anyone has
found a practical way of handling this.
Thanks
Frank Millman