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

void PoDoFo::PdfObject::WriteObject ( PdfOutputDevice pDevice,
EPdfWriteMode  eWriteMode,
PdfEncrypt pEncrypt,
const PdfName keyStop = PdfName::KeyNull 
) const [inherited]

Write the complete object to a file.

Parameters:
pDevicewrite the object to this device
pEncryptan encryption object which is used to encrypt this object or NULL to not encrypt this object
eWriteModeadditional options for writing the object
keyStopif not KeyNull and a key == keyStop is found writing will stop right before this key!

Definition at line 155 of file PdfObject.cpp.

References PoDoFo::PdfEncrypt::CalculateStreamLength(), PoDoFo::PdfObject::DelayedStreamLoad(), PoDoFo::ePdfError_InvalidHandle, PoDoFo::ePdfWriteMode_Clean, PoDoFo::PdfReference::GenerationNumber(), PoDoFo::PdfObject::GetIndirectKey(), PoDoFo::PdfStream::GetLength(), PoDoFo::PdfReference::IsIndirect(), PoDoFo::PdfReference::ObjectNumber(), PODOFO_RAISE_ERROR, PoDoFo::PdfOutputDevice::Print(), PoDoFo::PdfEncrypt::SetCurrentReference(), PoDoFo::PdfStream::Write(), and PoDoFo::PdfVariant::Write().

Referenced by PoDoFo::PdfWriter::CreateFileIdentifier(), PoDoFo::PdfXRefStream::EndWrite(), PoDoFo::PdfImmediateWriter::Finish(), PoDoFo::PdfObject::GetObjectLength(), and PoDoFo::PdfWriter::Write().

{
    DelayedStreamLoad();

    if( !pDevice )
    {
        PODOFO_RAISE_ERROR( ePdfError_InvalidHandle );
    }

    if( m_reference.IsIndirect() )
    {
        if( (eWriteMode & ePdfWriteMode_Clean) == ePdfWriteMode_Clean ) 
        {
            pDevice->Print( "%i %i obj\n", m_reference.ObjectNumber(), m_reference.GenerationNumber() );
        }
        else 
        {
            pDevice->Print( "%i %i obj", m_reference.ObjectNumber(), m_reference.GenerationNumber() );
        }
    }

    if( pEncrypt ) 
    {
        pEncrypt->SetCurrentReference( m_reference );
    }

    if( pEncrypt && m_pStream )
    {
        pdf_long lLength = pEncrypt->CalculateStreamLength(m_pStream->GetLength());
        PdfVariant varLength = static_cast<pdf_int64>(lLength);
        // Set length whether it is a key or an indirect reference
        *(const_cast<PdfObject*>(this)->GetIndirectKey( PdfName::KeyLength )) = varLength;
    }

    this->Write( pDevice, eWriteMode, pEncrypt, keyStop );
    pDevice->Print( "\n" );

    if( m_pStream )
    {
        m_pStream->Write( pDevice, pEncrypt );
    }

    if( m_reference.IsIndirect() )
    {
        pDevice->Print( "endobj\n" );
    }
}

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