Board index » delphi » copying from tprinter.canvas doesn't work

copying from tprinter.canvas doesn't work

I can do a "copyrect" from one Tcanvas to another, but I can't copy from the
TPrinter.Canvas property. Is TPrinter a special object from which you can't
read the Canvas property? It doesn't say so in the documentation. Here's a
code fragment that doesn't work:

     t:=rect(0,0,500,300);
     image1.canvas.copyrect(t,printer.canvas,t);

Prior to this I filled the page up with text using textout, and it prints
properly to boot. But I cannot read the canvas. Can anyone else achieve
this?

Thanks to all the great (and not-so-great :-) people here who offer their
help for almost every question that I ask.

 

Re:copying from tprinter.canvas doesn't work


A printer canvas is write only.

Pentecostal skrev i meddelelsen <7fo9sd$7k...@forums.borland.com>...

Quote
>I can do a "copyrect" from one Tcanvas to another, but I can't copy from
the
>TPrinter.Canvas property. Is TPrinter a special object from which you can't
>read the Canvas property?

Re:copying from tprinter.canvas doesn't work


Quote
> I can do a "copyrect" from one Tcanvas to another, but I can't copy from the
> TPrinter.Canvas property. Is TPrinter a special object from which you can't
> read the Canvas property? It doesn't say so in the documentation. Here's a
> code fragment that doesn't work:

You are labouring under a very common misunderstanding of what a Canvas really
is. You see, it has no storage of its own, what you draw on a canvas goes into
storage that belongs to the "device" (bitmap, metafile, part of the screen
covered by a window, printer) the canvas is attached to, the TCanvas object
only provides a convenient interface to the Windows GDI drawing routines.

A printers storage is inside the physical printer, usually the page you print
on since the printer may not even build a full page image in memory if it can
get by without it. The printer canvas is thus effectively write-only. Even if
the printer driver caches the drawing commands there is no way to get at this
information.

Peter Below (TeamB)  100113.1...@compuserve.com)
No e-mail responses, please, unless explicitely requested!

Other Threads