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

void PoDoFo::PdfParser::ParseFile ( const PdfRefCountedInputDevice rDevice,
bool  bLoadOnDemand = true 

Open a PDF file and parse it.

rDevicethe input device to read from
bLoadOnDemandIf true all objects will be read from the file at the time they are accesed first. If false all objects will be read immediately. This is faster if you do not need the complete PDF file in memory.

This might throw a PdfError( ePdfError_InvalidPassword ) exception if a password is required to read this PDF. Call SetPassword with the correct password in this case.

See also:

Definition at line 181 of file PdfParser.cpp.

References PoDoFo::PdfError::AddToCallstack(), Clear(), PoDoFo::ePdfError_InvalidPassword, PoDoFo::ePdfError_NoPdfFile, PoDoFo::PdfError::GetError(), IsPdfFile(), PODOFO_RAISE_ERROR, ReadDocumentStructure(), and ReadObjects().


    m_device = rDevice;

    m_bLoadOnDemand = bLoadOnDemand;

    try {
        if( !IsPdfFile() )
            PODOFO_RAISE_ERROR( ePdfError_NoPdfFile );
    } catch( PdfError & e ) {
        if( e.GetError() == ePdfError_InvalidPassword ) 
            // Do not clean up, expect user to call ParseFile again
            throw e;

        // If this is being called from a constructor then the
        // destructor will not be called.
        // Clean up here  
        e.AddToCallstack( __FILE__, __LINE__, "Unable to load objects from file." );
        throw e;

Here is the call graph for this function:

Generated by  Doxygen 1.6.0   Back to index