THPDFPage.UserHeight

THPDFPage

 

Top  Previous  Next

Returns the height of the page in drawing units, 1/THotPDF.Resolution inch.

 

Delphi syntax:

property UserHeight: Single; // read-only

 

C++ syntax:

__property float UserHeight = {read=GetUserHeight};

 

Description

Y coordinates, margins, font sizes and the values returned by TextWidth and TextHeight are in 1/Resolution inch. Height keeps the page height in points and takes points when you set it, so with a Resolution other than 72 it does not match the coordinates you draw with. Read UserHeight whenever you compare or combine the page height with drawing coordinates, for example to find the bottom margin edge, to center a block or to decide when content has to move to the next page.

At the default Resolution of 72, UserHeight equals Height. A page sized by setting Width and Height draws in points whatever the Resolution, and UserHeight then equals Height as well.

 

Code Example

program FooterLine;
{$APPTYPE CONSOLE}
uses
  SysUtils,
  HPDFDoc;

var
  HPDF: THotPDF;

begin
  HPDF:= THotPDF.Create(nil);
  try
    HPDF.FileName:= 'FooterLine.pdf';
    HPDF.Resolution:= 144;                    // Coordinates in 1/144 inch
    HPDF.BeginDoc;
    HPDF.CurrentPage.SetFont('Arial', [], 20); // 10 pt
    // UserHeight is 1684 on an A4 page here; Height stays 842 points
    HPDF.CurrentPage.TextOut(144, HPDF.CurrentPage.UserHeight- 144, 0,
      'Footer one inch above the bottom edge');
    HPDF.EndDoc;
  finally
    HPDF.Free;
  end;
end.

 

See also: Height, UserWidth, THotPDF.Resolution