trichview.com

trichview.support




Re: FooterYMM and BottomMarginMM


Return to index


Author

Message

Stefan M. Huber

Posted: 10/12/2004 17:16:36


On Tue, 12 Oct 2004 16:44:20 +0400, Sergey Tkachenko <svt@trichview.com> 

wrote:


> The corresponding parameters of GetDeviceCaps are specified on the image.

> They are returned in pixels.

> In order to convert them to mm, use the following formula:

> size_mm = (size_pixels*127)/(5*logpixels), where

> logpixels is

> for vertical sizes: value returned by GetDeviceCaps for LOGPIXELSY.

> for horizontal sizes: value returned by GetDeviceCaps for LOGPIXELSX.


This seems to have cured the problem. At least in my test application. 

Incorporation into the main application has to be done yet. This is the 

code that I now have


   // oRand, uRand, lRand, rRand are the margin variables (in mm) that

   // the user fills with his favourite values.

   PDC := RV_GetPrinterDC;

   if PDC <> 0 then

     try

       lpx     := GetDeviceCaps(PDC, LOGPIXELSX);

       lpy     := GetDeviceCaps(PDC, LOGPIXELSY);

       phofsx  := GetDeviceCaps(PDC, PHYSICALOFFSETX);

       phofsy  := GetDeviceCaps(PDC, PHYSICALOFFSETY);


       // the upper non-printing area

       mm := (phofsy * 127) / (5*lpy);

       oRand := Max(mm, oRand);


       // the left non-printing area

       mm := (phofsx * 127) / (5*lpx);

       lRand := Max(mm, lRand);


       // the bottom non-printing area

       mm := ((GetDeviceCaps(PDC, PHYSICALHEIGHT) -

               phofsy -

               GetDeviceCaps(PDC, VERTRES)) * 127) / (5*lpy);

       uRand := Max(mm, uRand);


       // the right non-printing area

       mm := ((GetDeviceCaps(PDC, PHYSICALWIDTH) -

               phofsx -

               GetDeviceCaps(PDC, HORZRES)) * 127) / (5*lpx);

       rRand := Max(mm, rRand);

     finally

       DeleteDC(PDC);

     end;


The best idea for the preview component might be to draw the nonprinting 

area as gray area (optionally, maybe).


Thanks again for your help,

Stefan





Powered by ABC Amber Outlook Express Converter