Hi
Is there a property in trvprint to get the coordinates of the foot inside the page to be printed?
Thanks in advance
Printing footer
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: Printing footer
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.
Its position is defined by TRVPrint.FooterY: a distance from the page bottom to the footer bottom, measured in TRVPrint.Units.
Re: Printing footer
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
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
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: Printing footer
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:
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, ...)