Page 1 of 1

Printing footer

Posted: Thu Mar 02, 2017 1:31 pm
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

Re: Printing footer

Posted: Fri Mar 03, 2017 8:08 am
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.

Re: Printing footer

Posted: Mon Mar 06, 2017 7:27 am
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

Re: Printing footer

Posted: Mon Mar 06, 2017 8:12 am
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, ...)