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

PoDoFo::PdfDestination::PdfDestination ( PdfObject pObject )

Create a new PdfDestination from an existing PdfObject (such as loaded from a doc)

Parameters:
pObjectthe object to construct from

Definition at line 49 of file PdfDestination.cpp.

References PoDoFo::ePdfDataType_Array, PoDoFo::ePdfDataType_String, PoDoFo::ePdfError_InvalidDataType, PoDoFo::ePdfError_InvalidName, PoDoFo::ePdfError_NoObject, PoDoFo::PdfVariant::GetArray(), PoDoFo::PdfVariant::GetDataType(), PoDoFo::PdfVariant::GetDictionary(), PoDoFo::PdfDictionary::GetKey(), PoDoFo::PdfDocument::GetNamesTree(), PoDoFo::PdfObject::GetOwner(), PoDoFo::PdfVecObjects::GetParentDocument(), PoDoFo::PdfVariant::GetString(), PoDoFo::PdfNamesTree::GetValue(), PoDoFo::PdfVariant::IsArray(), PoDoFo::PdfVariant::IsDictionary(), and PODOFO_RAISE_ERROR.

{
    if ( pObject->GetDataType() == ePdfDataType_Array ) 
    {
        m_array = pObject->GetArray();
    }
    else if( pObject->GetDataType() == ePdfDataType_String ) 
    {
        PdfDocument* pDoc = pObject->GetOwner()->GetParentDocument();
        if( pDoc ) 
        {
            PdfNamesTree* pNames = pDoc->GetNamesTree( ePdfDontCreateObject );
            if( !pNames ) 
            {
                PODOFO_RAISE_ERROR( ePdfError_NoObject );
            }
            
            PdfObject* pValue = pNames->GetValue( "Dests", pObject->GetString() );
            if( !pValue ) 
            {
                PODOFO_RAISE_ERROR( ePdfError_InvalidName );
            }

            if( pValue->IsArray() ) 
                m_array = pValue->GetArray();
            else if( pValue->IsDictionary() )
                m_array = pValue->GetDictionary().GetKey( "D" )->GetArray();
        }
    }
    else 
    {
        PODOFO_RAISE_ERROR( ePdfError_InvalidDataType );
    }

    m_pObject = pObject;
}

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index