John

To save trees you could use FreePDF XP as a preview

John Bird wrote:
The reason I want to see the printer canvas is the usual reason for wanting
to see a print preview - what I am sending to the printer is NOT the same as
the original form, I have added headers, and omitted some items, tweaked
font sizes etc, so that is what I want to see.  At present I am running to
the laser printer too much!

From the documentation and tests I did the scaling is handled by the
different sizes of the rects in copyrect, yes of course the printer canvas
and form canvas are greatly different sizes  (eg 800x600  vs 2400x3171 for
300 DPI to A4)

The code I am using for printing adds items to Printer.Canvas one by one,
using Printer.canvas.textout, so I was assuming I could copy back from the
printer canvas similarly, but grab the whole rect.

A related question is how come Windows never provided a print preview as
part of printing?

John

-----Original Message-----
From: Kyley Harris [mailto:[EMAIL PROTECTED] Sent: Friday, 25 November 2005 3:13 p.m.
To: [EMAIL PROTECTED]; NZ Borland Developers Group - Delphi List
Subject: Re: [DUG] Print Preview


It boggles me why you would do that?

Surely you have a source that you are sending to the Printer Canvas? simply place that source onto another
canvas? Why try and read from output when you have the original?

Also. Don't forget that your printer canvas is going to be 200-300-600dpi or anything. You need to scale
your information correctly if you want to see anything useful.

If you have code that prints to a canvas, just make sure the code is using regions defined by the inclusion
of X and Y DPI modifiers.

for my report engine I use Points as the unit of measurement, the same as PDF. When I am drawing to a preview I just set the DPI to 96 (screen.pixelsperinch) if I want a 50% view i set DPI to 48. 200% is 192dpi etc. Some fonts wont scale well. All measuremeents will be Size*DPI/72 (72 is points per inch)

so, even if you could copy off a canvas, you shouldn't. the results would be undesirable.

On Fri, 25 Nov 2005 14:56:38 +1300, John Bird <[EMAIL PROTECTED]> wrote:


Was experimenting with adding a print preview by copying from the Printer.canvas to a form.canvas and showing it

PrintRect,PreviewRect:TRect;
begin
       duPageWidth:=GetDeviceCaps(Printer.Canvas.Handle,PHYSICALWIDTH);
duPageHeight:=GetDeviceCaps(Printer.Canvas.Handle,PHYSICALHEIGHT);

     //show this page with copyrect command
     PrintRect:=Rect(10,10,duPageWidth-20,duPageHeight-20);


PreviewRect:=Rect(10,10,frmjkblPrint.Width-20,frmjkblPrint.Height-20);

     frmjkblPrint.Canvas.CopyRect(PreviewRect,Printer.Canvas,PrintRect);
     frmjkblPrint.show;

But it doesn't work...
Is it legit to copyrect from Printer.canvas?


John


_______________________________________________
Delphi mailing list
[email protected] http://ns3.123.co.nz/mailman/listinfo/delphi





--
Neven MacEwan (B.E. E&E)
Ph. 09 620 1356 Mob. 027 4749 062

New Address Details
===================
MWK Computer Systems
1 Taumata Rd
Sandringham
Auckland

Ph 620 1356
Fx 620 1336
begin:vcard
fn:Neven MacEwan
n:MacEwan;Neven
email;internet:[EMAIL PROTECTED]
tel;work:649 620 1356
tel;fax:649 620 1336
tel;cell:0274 749 062
version:2.1
end:vcard

_______________________________________________
Delphi mailing list
[email protected]
http://ns3.123.co.nz/mailman/listinfo/delphi

Reply via email to