Author: Jonas Bilinkevicius
Does anybody know how to get, programmatically, the location of the canvas on the
piece of paper that emerges from the printer? i.e. the size of the top, left, right
and bottom margins?
Answer:
1 procedure TPrtPvw.GetOffsetPrinter;
2 var3 pt: TPoint;
4 tmpAncho, tmpAlto: longint;
5 begin6 Escape(hPrinter, GETPRINTINGOFFSET, 0, nil, @pt);
7 gOffSetLeft := pt.X;
8 gOffSetTop := pt.Y;
9 Escape(hPrinter, GETPHYSPAGESIZE, 0, nil, @pt);
10 tmpAncho := pt.X;
11 tmpAlto := pt.Y;
12 gOffSetRight := tmpAncho - gOffSetLeft - Printer.PageWidth;
13 gOffSetBottom := tmpAlto - gOffSetTop - Printer.PageHeight;
14 end;