Printing footer

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

Printing footer

Post by jota » Thu Mar 02, 2017 1:31 pm

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: 14398
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Printing footer

Post by Sergey Tkachenko » Fri Mar 03, 2017 8:08 am

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: 44
Joined: Fri Sep 16, 2011 10:56 am

Re: Printing footer

Post by jota » Mon Mar 06, 2017 7:27 am

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: 14398
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Printing footer

Post by Sergey Tkachenko » Mon Mar 06, 2017 8:12 am

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