PageHeight
IPDFDocument4 :: Page Operations :: Common

See Also Example
Collapse All

This property gets or sets the height of the current page.

Syntax

FLOAT PageHeight { get; set; }
Value
The height (in pixels) of the current page

Remarks

All changes to a page must occur before the first drawing on a page.

Example

How to Draw Centered Text

Delphi
[copy to clipboard]
// PDF object is supposed to be created
str := 'Centered text.';
fnt := PDF.AddBuiltInFont(bfTimesRoman, false, false);
PDF.UseFont(fnt, 40);
w := PDF.GetUnicodeTextWidth(str);
h := PDF.GetUnicodeTextHeight(str);
PDF.ShowTextAt((PDF.PageWidth - w) / 2, (PDF.PageHeight - h) / 2, str);
PDF.SaveToFile('test.pdf', true);
C/C++
[copy to clipboard]
// PDF object is supposed to be created
wstring str = L"Centered text.";
long fnt = PDF->AddBuiltInFont(bfTimesRoman, false, false);
PDF->UseFont(fnt, 40);
float w = PDF->GetUnicodeTextWidth(str);
float h = PDF->GetUnicodeTextHeight(str);
PDF->ShowTextAt((PDF->PageWidth - w) / 2, (PDF->PageHeight - h) / 2, str);
PDF->SaveToFile("test.pdf", true);
C#
[copy to clipboard]
// PDF object is supposed to be created
string str = "Centered text.";
long fnt = PDF.AddBuiltInFont(BuiltInFont.bfTimesRoman, false, false);
PDF.UseFont(fnt, 40);
float w = PDF.GetUnicodeTextWidth(str);
float h = PDF.GetUnicodeTextHeight(str);
PDF.ShowTextAt((PDF.PageWidth - w) / 2, (PDF.PageHeight - h) / 2, str);
PDF.SaveToFile("test.pdf", true);
Visual Basic
[copy to clipboard]
' PDF object is supposed to be created
str = "Centered text."
fnt = PDF.AddBuiltInFont(0, false, false) 'BuiltInFont.bfTimesRoman = 0
PDF.UseFont fnt, 40
w = PDF.GetUnicodeTextWidth(str)
h = PDF.GetUnicodeTextHeight(str)
PDF.ShowTextAt (PDF.PageWidth - w) / 2, (PDF.PageHeight - h) / 2, str
PDF.SaveToFile "test.pdf", true

See Also

Reference