Printing footer

General TRichView support forum. Please post your questions here
Post Reply
jota
Posts: 48
Joined: Fri Sep 16, 2011 10:56 am

Printing footer

Post by jota »

Hi

Is there a property in trvprint to get the coordinates of the foot inside the page to be printed?

Thanks in advance
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Printing footer

Post by Sergey Tkachenko »

I assume you ask about a footer assigned by TRVPrint.SetFooter.
Its position is defined by TRVPrint.FooterY: a distance from the page bottom to the footer bottom, measured in TRVPrint.Units.
jota
Posts: 48
Joined: Fri Sep 16, 2011 10:56 am

Re: Printing footer

Post by jota »

Hi

I´m looking for coordinates of the foot to present a TextOut with page counter, in the OnPagePostpaint event, so that I can collect updated or recalculate those coordinates when I use trvprintpreview.

Thanks
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Printing footer

Post by Sergey Tkachenko »

Do you mean a text header/footer drawn by RichViewActions?

They draw header above the main page text, and footer below the main page text. Main page text is in the rectangle specified in PrintAreaRect parameter of OnPagePrepaint.
It is calculated using TRVPrint.Margins property (TopMargin and BottomMargin)

See the code in RichViewActions:

Code: Select all

    ppi := Canvas.Font.PixelsPerInch;
    ...
    h := Canvas.TextHeight(S);
    if Header then
      Y := PrintAreaRect.Top - h - ppi div 20
    else
      Y := PrintAreaRect.Bottom + ppi div 20;
    R := Rect(PrintAreaRect.Left, Y, PrintAreaRect.Right, Y + h);
    ...
    DrawText(Canvas.Handle, PChar(S), Length(S), R, ...)
Post Reply