I have a couple of related issues. I'm trying to send
images to a Windows printer. The images I'm currently
working with are JPGs, but I expect to use a variety of
image types eventually. However, I don't think the source
file should matter much, because once I've loaded them into
wxImages, they should all be equivalent, right?
However, something really strange happens when I try to
print these images. I can generate text just fine, I can
DrawRectangle to get the outlines of where the images should
be, and that all works perfectly. But the images themselves
won't print when the printer is in normal mode. The weird
thing is that if I put the printer into draft/fast mode,
then they *do* print. They're also perfectly visible in
Print Preview mode. I'm baffled as to why this should
be--the demo print framework prints images just fine,
without needing to be switched to draft mode. This happens
regardless of the printer that I use (I've used two
different HP Deskjet models).
Similarly, I want to print these images on a laser printer,
but with these, I can't get anything regardless of the
quality setting. I'm not sure if this is another symptom of
the same issue, or if it's a problem with the color/b&w
translation. But again, the demo prints color images just
fine on the laser printers.... (two different HP Laserjet
models).
Here's the relevant portions of my wxPrintout class's
OnPrint method:
···
------------------------
def OnPrintPage(self, page):
dc = self.GetDC()
width, height = dc.GetSizeTuple()
# skipping various calculations to scale images and
# get proper positions to print at...
textwidth, textheight =
dc.GetTextExtent(self.caption)
dc.DrawText(self.caption,
x=((width-textwidth)/2)+50, y=50)
dc.DrawRectangle(50, front_y+50, width, frontheight)
dc.DrawRectangle(50, back_y+50, width, backheight)
# self.front & self.back are wxImages
frontimg = self.front.Scale(width, frontheight)
backimg = self.back.Scale(width, backheight)
dc.DrawBitmap(frontimg.ConvertToBitmap(), 50,
front_y, true)
dc.DrawBitmap(backimg.ConvertToBitmap(), 50, back_y,
true)
return true
------------------
As mentioned before, the text and rectangles are drawn just
fine, in any circumstances, it's just the DrawBitmap
routines that don't seem to work. (I've also tried with the
final transparent parameter set to false.)
Has anyone else seen anything like this? Any ideas what
might be going on? Am I simply insane?
Jeff Shannon
Technician/Programmer
Credit International