Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to get the Pageheight in mm

83 views
Skip to first unread message

Joachim Marder

unread,
Oct 14, 1996, 3:00:00 AM10/14/96
to

Hi!

When I'm printing, I need to know the page height in mm (or inch). There's the
function TPrinter.GetPrinter, where I can receive a DEVINFO structure.
Does anybody know how to use this function and waht I must pass for the first
three arguments? Or is there another way to get the PageHeight?


Joey

Michael Nestler

unread,
Oct 15, 1996, 3:00:00 AM10/15/96
to

In article <53tk5s$j...@news01.uni-trier.de>, mar...@explorer.uni-trier.de


Try using

dpi := GetDeviceCaps(Printer.Canvas.Handle,LOGPIXELSY);

to get the number of pixels per inch. If you want the pageheight in mm you
have to use

pageheight := Printer.PageHeight / dpi * 25.4;

The same should work with Printer.Canvas.Height.


Michael

Jochen Heyland

unread,
Oct 15, 1996, 3:00:00 AM10/15/96
to
says...

>
>Hi!
>
>When I'm printing, I need to know the page height in mm (or inch). There's
the
>function TPrinter.GetPrinter, where I can receive a DEVINFO structure.
>Does anybody know how to use this function and waht I must pass for the first
>three arguments? Or is there another way to get the PageHeight?
>
>
> Joey
The easiest way is to set the map mode of printer.canvas to mm_lometric,
get the height with GetDeviceCaps and divide by -10. Personally, I prefer to
do my printing in a map mode other than mm_text to avoid resolution problems.
The reversed sign's a pain, though.
Hope this helps,
Jochen

David A. Schweizer

unread,
Oct 17, 1996, 3:00:00 AM10/17/96
to

m...@irz.inf.tu-dresden.de (Michael Nestler) wrote:

>(Joachim Marder) writes:
>>Hi!
>>
>>When I'm printing, I need to know the page height in mm (or inch). There's
>>the
>>function TPrinter.GetPrinter, where I can receive a DEVINFO structure.
>>Does anybody know how to use this function and waht I must pass for the
>>first
>>three arguments? Or is there another way to get the PageHeight?
>>
>>
>> Joey
>>


>Try using

>dpi := GetDeviceCaps(Printer.Canvas.Handle,LOGPIXELSY);

>to get the number of pixels per inch. If you want the pageheight in mm you
>have to use

>pageheight := Printer.PageHeight / dpi * 25.4;

>The same should work with Printer.Canvas.Height.


> Michael
Or try

pageheight := GetDeviceCaps(Printer.Canvas.Handle,VERTSIZE);

to get the height in millimeters directly.

David

0 new messages