trichview.support
Re: Printing |
Author |
Message |
Sergey Tkachenko |
Posted: 10/31/2002 17:19:20 This function calculates Width and Height of RichView document on printer, excluding all RVPrint.***MarginMM procedure GetPageSize(RVPrint: TRVPrint; var Width, Height: Integer); var DC: HDC; phoX, phoY, phW, phH, lpy, lpx, LM, TM, RM, BM: Integer; begin DC := RV_GetPrinterDC; // from PtblRV unit Width := GetDeviceCaps(DC, HORZRES); Height := GetDeviceCaps(DC, VERTRES); lpy := GetDeviceCaps(DC, LOGPIXELSY); lpx := GetDeviceCaps(DC, LOGPIXELSX); phoX := GetDeviceCaps(DC, PHYSICALOFFSETX); phoY := GetDeviceCaps(DC, PHYSICALOFFSETY); phW := GetDeviceCaps(DC, PHYSICALWIDTH); phH := GetDeviceCaps(DC, PHYSICALHEIGHT); LM := MulDiv(RVPrint.LeftMarginMM, 5*lpx, 127)- phoX; TM := MulDiv(RVPrint.TopMarginMM, 5*lpy, 127)- phoY; RM := MulDiv(RVPrint.RightMarginMM, 5*lpx, 127)- (phW-(phoX+Width)); BM := MulDiv(RVPrint.BottomMarginMM, 5*lpy, 127)- (phH-(phoY+Height)); if LM<0 then LM := 0; if TM<0 then TM := 0; if RM<0 then RM := 0; if BM<0 then BM := 0; dec(Width, LM+RM); dec(Height, TM+BM); DeleteDC(DC); end; As you can see, this value does not depend on richview document, it depends only on paper size, printer resolution and margins of RVPrint. Besides, RVPrint.EndAt returns a real height of document on the last page. This value can be used only after call of FormatPages. > > Do you want width&height measured in millimeters? Or in pixels (dots) of > > printer? Or in pixels on the screen? > > Pixels of Printer. > > Are RichView.DocumentHeight equivalent > to how many pixels in printer? > > > |
Powered by ABC Amber Outlook Express Converter