[DUG] Print Preview

Kyley Harris kyleyharris at gmail.com
Fri Nov 25 15:13:27 NZDT 2005


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 <johnkbird at paradise.net.nz>  
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
> Delphi at ns3.123.co.nz
> http://ns3.123.co.nz/mailman/listinfo/delphi



-- 
Kyley Harris
+64-21-671821


More information about the Delphi mailing list