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

void PoDoFo::PdfPagesTree::DeletePage ( int  inPageNumber )

Delete the specified page object from the internal pages tree. It does NOT remove any PdfObjects from memory - just the reference from the tree

Parameters:
inPageNumberthe page number (0-based) to be removed

The PdfPage object refering to this page will be deleted by this call! Empty page nodes will also be deleted.

See also:
PdfMemDocument::DeletePages

Definition at line 175 of file PdfPagesTree.cpp.

References PoDoFo::PdfPagesTreeCache::DeletePage(), DeletePageFromNode(), PoDoFo::eLogSeverity_Error, PoDoFo::eLogSeverity_Information, PoDoFo::ePdfError_PageNotFound, GetPosInKids(), GetRoot(), PoDoFo::PdfError::LogMessage(), and PODOFO_RAISE_ERROR.

Referenced by PoDoFo::PdfMemDocument::DeletePages().

{
    // Delete from cache
    m_cache.DeletePage( nPageNumber );
    
    // Delete from pages tree
    PdfObjectList lstParents;
    PdfObject* pPageNode = this->GetPageNode( nPageNumber, this->GetRoot(), lstParents );

    if( !pPageNode ) 
    {
        PdfError::LogMessage( eLogSeverity_Information,
                              "Invalid argument to PdfPagesTree::DeletePage: %i - Page not found\n",
                              nPageNumber );
        PODOFO_RAISE_ERROR( ePdfError_PageNotFound );
    }

    if( lstParents.size() > 0 ) 
    {
        PdfObject* pParent = lstParents.back();
        int nKidsIndex = this->GetPosInKids( pPageNode, pParent );
        
        DeletePageFromNode( pParent, lstParents, nKidsIndex, pPageNode );
    }
    else
    {
        PdfError::LogMessage( eLogSeverity_Error,
                              "PdfPagesTree::DeletePage: Page %i has no parent - cannot be deleted.\n",
                              nPageNumber );
        PODOFO_RAISE_ERROR( ePdfError_PageNotFound );
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index