示例#1
0
bool PdfDictionary::HasKey( const PdfName & key ) const
{
    if( !key.GetLength() )
        return false;
    
    return ( m_mapKeys.find( key ) != m_mapKeys.end() );
}
示例#2
0
PdfAction::PdfAction( EPdfAction eAction, PdfDocument* pParent )
    : PdfElement( "Action", pParent ), m_eType( eAction )
{
    const PdfName type = PdfName( TypeNameForIndex( eAction, s_names, s_lNumActions ) );

    if( !type.GetLength() )
    {
        PODOFO_RAISE_ERROR( ePdfError_InvalidHandle );
    }

    this->GetObject()->GetDictionary().AddKey( "S", type );
}
示例#3
0
void PdfDictionary::Write( PdfOutputDevice* pDevice, const PdfEncrypt* pEncrypt, const PdfName & keyStop ) const
{
    TCIKeyMap     itKeys;

    pDevice->Print( "<<\n" );

    itKeys     = m_mapKeys.begin();

    if( keyStop != PdfName::KeyNull && keyStop.GetLength() && keyStop == PdfName::KeyType )
        return;

    if( this->HasKey( PdfName::KeyType ) ) 
    {
        // Type has to be the first key in any dictionary
        pDevice->Print( "/Type " );
        this->GetKey( PdfName::KeyType )->Write( pDevice, pEncrypt );
        pDevice->Print( "\n" );
    }

    while( itKeys != m_mapKeys.end() )
    {
        if( (*itKeys).first != PdfName::KeyType )
        {
            if( keyStop != PdfName::KeyNull && keyStop.GetLength() && (*itKeys).first == keyStop )
                return;

            (*itKeys).first.Write( pDevice );
            pDevice->Write( " ", 1 ); // write a separator
            (*itKeys).second->Write( pDevice, pEncrypt );
            pDevice->Write( "\n", 1 );
        }
        
        ++itKeys;
    }

    pDevice->Print( ">>" );
}