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

void PoDoFo::PdfImmediateWriter::Finish (  ) [private, virtual]

Finish the PDF file. I.e. write the XRef and close the output device.

Implements PoDoFo::PdfVecObjects::Observer.

Definition at line 97 of file PdfImmediateWriter.cpp.

References PoDoFo::PdfEncrypt::CreateEncryptionDictionary(), PoDoFo::PdfVecObjects::CreateObject(), PoDoFo::PdfVecObjects::Detach(), PoDoFo::PdfWriter::FillTrailerObject(), FinishLastObject(), PoDoFo::PdfOutputDevice::Flush(), PoDoFo::PdfVariant::GetDictionary(), PoDoFo::PdfXRef::GetSize(), GetWriteMode(), PoDoFo::PdfWriter::m_pEncrypt, PoDoFo::PdfWriter::m_pEncryptObj, PoDoFo::PdfWriter::m_vecObjects, PoDoFo::PdfOutputDevice::Print(), PoDoFo::PdfOutputDevice::Tell(), PoDoFo::PdfXRef::Write(), PoDoFo::PdfObject::WriteObject(), and PoDoFo::PdfWriter::WritePdfObjects().

{
    // write all objects which are still in RAM
    this->FinishLastObject();

    // setup encrypt dictionary
    if( m_pEncrypt )
    {
        // Add our own Encryption dictionary
        m_pEncryptObj = m_vecObjects->CreateObject();
        m_pEncrypt->CreateEncryptionDictionary( m_pEncryptObj->GetDictionary() );
    }

    this->WritePdfObjects( m_pDevice, *m_pParent, m_pXRef );

    // write the XRef
    pdf_long lXRefOffset = m_pDevice->Tell();
    m_pXRef->Write( m_pDevice );
            
    // XRef streams contain the trailer in the XRef
    if( !m_bXRefStream ) 
    {
        PdfObject trailer;
        
        // if we have a dummy offset we write also a prev entry to the trailer
        FillTrailerObject( &trailer, m_pXRef->GetSize(), false, false );
        
        m_pDevice->Print("trailer\n");
        trailer.WriteObject( m_pDevice, this->GetWriteMode(), NULL );
    }
    
    m_pDevice->Print( "startxref\n%li\n%%%%EOF\n", lXRefOffset );
    m_pDevice->Flush();

    // we are done now
    m_pParent->Detach( this );
    m_pParent = NULL;
}

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index