THPDFPage.UserHeight

THPDFPage

 

Top  Previous  Next

Returns the page height measured in drawing units, i.e. 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 TextWidth and TextHeight return are all expressed in 1/Resolution inch. Height stores the page height in points and expects points when you assign it, so at any Resolution other than 72 it will not match the coordinates you draw with. Read UserHeight whenever the page height has to be compared or combined with drawing coordinates — finding the bottom margin edge, centring a block or deciding when content must move onto the next page, for instance

At the default Resolution of 72, UserHeight matches Height. A page sized through Width and Height draws in points regardless of the Resolution, and UserHeight then matches Height too

 

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