[Image-SIG] Re: Problem printing images via ImageWin

Fredrik Lundh fredrik at pythonware.com
Sat Jun 21 16:28:49 EDT 2003


howard at eegsoftware.com wrote:

> I am trying to use the code snippet below to print images (under
> Windows).  The output file (out.png) is correctly saved but nothing ever
> prints.  When I uncomment out the WritePrinter command, the text prints
> so I am *assuming* I opened the printer OK.
>
> It appears that expose function does not send anything to the printer
> context.   This is PIL.1.1.4 (binary installer).

iirc, expose uses the BitBlt method, which is not supported by all
printer drivers.

try using the "draw" method instead:

    dib.draw(hdc, xy)

where "xy" is a 4-tuple giving the (left, upper, right, lower)
border, in printer coordinates.  to check if this works, start
with

    dib.draw(hdc, (0, 0) + img.size)

and tweak as necessary.

</F>






More information about the Image-SIG mailing list