Logo Search packages:      
Sourcecode: libpodofo version File versions  Download package

unsigned int PoDoFo::PdfPage::GetPageNumber (  ) const

Page number inside of the document. The first page has the number 1, the last page has the number PdfPagesTree:GetTotalNumberOfPages()

the number of the page inside of the document
See also:

Definition at line 484 of file PdfPage.cpp.

References PoDoFo::PdfArray::begin(), PoDoFo::PdfArray::end(), PoDoFo::PdfVariant::GetArray(), PoDoFo::PdfVariant::GetDictionary(), PoDoFo::PdfObject::GetIndirectKey(), PoDoFo::PdfDictionary::GetKey(), PoDoFo::PdfVariant::GetName(), PoDoFo::PdfVariant::GetNumber(), PoDoFo::PdfVecObjects::GetObject(), PoDoFo::PdfElement::GetObject(), PoDoFo::PdfObject::GetOwner(), and PoDoFo::PdfObject::Reference().

    unsigned int        nPageNumber = 0;
    PdfObject*          pParent     = this->GetObject()->GetIndirectKey( "Parent" );
    PdfReference ref                = this->GetObject()->Reference();

    while( pParent ) 
        const PdfArray& kids        = pParent->GetIndirectKey( "Kids" )->GetArray();
        PdfArray::const_iterator it = kids.begin();

        while( it != kids.end() && (*it).GetReference() != ref )
            PdfObject* pNode = this->GetObject()->GetOwner()->GetObject( (*it).GetReference() );

            if( pNode->GetDictionary().GetKey( PdfName::KeyType )->GetName() == PdfName( "Pages" ) )
                nPageNumber += static_cast<int>(pNode->GetDictionary().GetKey( "Count" )->GetNumber());
                // if we do not have a page tree node, 
                // we most likely have a page object:
                // so the page count is 1


        ref     = pParent->Reference();
        pParent = pParent->GetIndirectKey( "Parent" );

    return ++nPageNumber;

Here is the call graph for this function:

Generated by  Doxygen 1.6.0   Back to index