PageCount
IPDFDocument3 :: General document methods

See Also Example
Collapse All

This property gets the number of pages in the current PDF document.

Syntax

LONG PageCount { get; }
Value
Number of pages in the current PDF document

Remarks

PageCount returns the total number of pages in the PDF document.

Equivalent in new interface: IPDFDocument4::GetPageCount.

Example

Using the PageCount Property

Delphi
[copy to clipboard]
{ PDF object is supposed to be created }
PDF.BeginDoc;
PDF.NewPage;
PDF.NewPage;
for i := 0 to PDF.PageCount-1 do
begin
    PDF.SetCurrentPage(i);
    PDF.PDFPAGE_SetActiveFont('Verdana', False, False, False, False, 8.0, 0);
    PDF.PDFPAGE_TextOut(100, 100, 0.0, 'Page ' + IntToStr(i + 1));
end;
PDF.EndDoc;
C/C++
[copy to clipboard]
// PDF object is supposed to be created
PDF->BeginDoc();
PDF->NewPage();
PDF->NewPage();
for (LONG i = 0; i < PDF.PageCount; i++)
{
    PDF->SetCurrentPage(i);
    PDF->PDFPAGE_SetActiveFont("Verdana", FALSE, FALSE, FALSE, FALSE, 8.0, 0);
    CString str;
    str->Format("Page %d", i + 1);
    PDF->PDFPAGE_TextOut(100, 100, 0.0, str);
}
PDF.EndDoc();
C#
[copy to clipboard]
// PDF object is supposed to be created
PDF.BeginDoc();
PDF.NewPage();
PDF.NewPage();
for (long i = 0; i < PDF.PageCount; i++)
{
    PDF.SetCurrentPage(i);
    PDF.PDFPAGE_SetActiveFont("Verdana", FALSE, FALSE, FALSE, FALSE, 8, 0);
    string str = "Page " + (i + 1).ToString();
    PDF.PDFPAGE_TextOut(100, 100, 0, str);
}
PDF.EndDoc();
Visual Basic
[copy to clipboard]
' PDF object is supposed to be created
PDF.BeginDoc
PDF.NewPage
PDF.NewPage
for i=0 to PDF.PageCount-1
    PDF.SetCurrentPage i
    PDF.PDFPAGE_SetActiveFont "Verdana", FALSE, FALSE, FALSE, FALSE, 8, 0
    PDF.PDFPAGE_TextOut 100, 100, 0, "Page " & i + 1
next
PDF.EndDoc

See Also

Reference