PageHeight
IPDFDocument3 :: General document methods

See Also Example
Collapse All

This property gets the height (in pixels) of the current page.

Syntax

LONG PageHeight { get; }
Value
Height (in pixels) of the current page

Remarks

PageHeight returns the height of the current page in a PDF document.

Equivalent in new interface: IPDFDocument4::PageHeight.

Example

How to Print Centered Text

Delphi
[copy to clipboard]
{ PDF object is supposed to be created }
PDF.BeginDoc;
PDF.PDFPAGE_SetActiveFont('Verdana', false, false, false, false, 16.0, 0);
txt := 'Centered text.';
h := PDF.PDFPAGE_GetTextHeight(txt);
w := PDF.PDFPAGE_GetTextWidth(txt);
l := (PDF.PageWidth - w) / 2;
t := (PDF.PageHeight - h) / 2;
PDF.PDFPAGE_TextOut(l, t, 0.0, txt);
PDF.EndDoc;
C/C++
[copy to clipboard]
// PDF object is supposed to be created
PDF->BeginDoc();
PDF->PDFPAGE_SetActiveFont("Verdana", FALSE, FALSE, FALSE, FALSE, 16.0, 0);
CHAR* txt = "Centered text.";
DOUBLE h = PDF->PDFPAGE_GetTextHeight(txt);
DOUBLE w = PDF->PDFPAGE_GetTextWidth(txt);
DOUBLE l = (PDF->PageWidth - w) / 2.0;
DOUBLE t = (PDF->PageHeight - h) / 2.0;
PDF->PDFPAGE_TextOut(l, t, 0.0, txt);
PDF->EndDoc();
C#
[copy to clipboard]
// PDF object is supposed to be created
PDF.BeginDoc();
PDF.PDFPAGE_SetActiveFont("Verdana", false, false, false, false, 16.0, 0);
string txt = "Centered text.";
double h = PDF.PDFPAGE_GetTextHeight(txt);
double w = PDF.PDFPAGE_GetTextWidth(txt);
double l = (PDF.PageWidth - w) / 2.0;
double t = (PDF.PageHeight - h) / 2.0;
PDF.PDFPAGE_TextOut(l, t, 0.0, txt);
PDF.EndDoc();
Visual Basic
[copy to clipboard]
' PDF object is supposed to be created
PDF.BeginDoc
PDF.PDFPAGE_SetActiveFont "Verdana", False, False, False, False, 16.0, 0
txt = "Centered text."
h = PDF.PDFPAGE_GetTextHeight(txt)
w = PDF.PDFPAGE_GetTextWidth(txt)
l = (PDF.PageWidth - w) / 2
t = (PDF.PageHeight - h) /2
PDF.PDFPAGE_TextOut l, t, 0.0, txt
PDF.EndDoc

See Also

Reference