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

void PoDoFo::PdfParser::UpdateDocumentVersion (  ) [private]

Determines the correct version of the PDF from the document catalog (if available). as, PDF > 1.4 allows updating the version.

If no catalog dictionary is present or no /Version key is available, the version from the file header will be used.

Definition at line 1174 of file PdfParser.cpp.

References PoDoFo::eLogSeverity_Information, PoDoFo::PdfVariant::GetDictionary(), PoDoFo::PdfDictionary::GetKey(), PoDoFo::PdfName::GetName(), PoDoFo::PdfVariant::GetName(), PoDoFo::PdfVecObjects::GetObject(), PoDoFo::PdfVariant::GetReference(), PoDoFo::PdfDictionary::HasKey(), PoDoFo::PdfVariant::IsDictionary(), PoDoFo::PdfVariant::IsReference(), and PoDoFo::PdfError::LogMessage().

Referenced by ReadObjectsInternal().

{
    if( m_pTrailer->IsDictionary() && m_pTrailer->GetDictionary().HasKey( PdfName("Root") ) )
    {
        PdfObject* pCatalog = m_pTrailer->GetDictionary().GetKey( PdfName("Root") );
        if( pCatalog->IsReference() ) 
        {
            pCatalog = m_vecObjects->GetObject( pCatalog->GetReference() );
        }

        if( pCatalog
            && pCatalog->IsDictionary() 
            && pCatalog->GetDictionary().HasKey( PdfName("Version" ) ) ) 
        {
            PdfObject* pVersion = pCatalog->GetDictionary().GetKey( PdfName( "Version" ) );
            for(int i=0;i<=MAX_PDF_VERSION_STRING_INDEX;i++)
            {
                if(pVersion->GetName().GetName() == s_szPdfVersionNums[i])
                {
                    PdfError::LogMessage( eLogSeverity_Information,
                                          "Updating version from %s to %s\n", 
                                          s_szPdfVersionNums[static_cast<int>(m_ePdfVersion)],
                                          s_szPdfVersionNums[i] );
                    m_ePdfVersion = static_cast<EPdfVersion>(i);
                    break;
                }
            }
        }
    }
    
}

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