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

void PoDoFo::PdfOutputDevice::Write ( const char *  pBuffer,
size_t  lLen 
) [virtual]

Write data to the buffer. Use this call instead of Print if you want to write binary data to the PdfOutputDevice.

Parameters:
pBuffera pointer to the data buffer
lLenwrite lLen bytes of pBuffer to the PdfOutputDevice
Returns:
ErrOk on success
See also:
Print

Definition at line 225 of file PdfOutputDevice.cpp.

References PoDoFo::ePdfError_OutOfMemory, PoDoFo::ePdfError_UnexpectedEOF, PoDoFo::PdfRefCountedBuffer::GetBuffer(), PoDoFo::PdfRefCountedBuffer::GetSize(), PODOFO_RAISE_ERROR, PODOFO_RAISE_ERROR_INFO, and PoDoFo::PdfRefCountedBuffer::Resize().

Referenced by PoDoFo::PdfFontTTFSubset::BuildFont(), PoDoFo::PdfMemDocument::InitFromParser(), PoDoFo::PdfVariant::Write(), PoDoFo::NonPublic::PdfTTFWriter::Write(), PoDoFo::PdfString::Write(), PoDoFo::PdfDeviceOutputStream::Write(), PoDoFo::PdfName::Write(), PoDoFo::PdfMemStream::Write(), PoDoFo::PdfDictionary::Write(), PoDoFo::PdfData::Write(), PoDoFo::NonPublic::PdfTTFWriter::WriteHeadTable(), PoDoFo::NonPublic::PdfTTFWriter::WriteMaxpTable(), PoDoFo::NonPublic::PdfTTFWriter::WriteTable(), PoDoFo::NonPublic::PdfTTFWriter::WriteTableDirectory(), and PoDoFo::NonPublic::PdfTTFWriter::WriteTableDirectoryEntry().

{
    if( m_hFile )
    {
        if( fwrite( pBuffer, sizeof(char), lLen, m_hFile ) != static_cast<size_t>(lLen) )
        {
            PODOFO_RAISE_ERROR( ePdfError_UnexpectedEOF );
        }
    }
    else if( m_pBuffer )
    {
        if( m_ulPosition + lLen <= m_lBufferLen )
        {
            memcpy( m_pBuffer + m_ulPosition, pBuffer, lLen );
        }
        else
        {
            PODOFO_RAISE_ERROR_INFO( ePdfError_OutOfMemory, "Allocated buffer to small for PdfOutputDevice. Cannot write!"  );
        }
    }
    else if( m_pStream )
    {
        m_pStream->write( pBuffer, lLen );
    }
    else if( m_pRefCountedBuffer ) 
    {
        if( m_ulPosition + lLen > m_pRefCountedBuffer->GetSize() )
            m_pRefCountedBuffer->Resize( m_ulPosition + lLen );

        memcpy( m_pRefCountedBuffer->GetBuffer() + m_ulPosition, pBuffer, lLen );
    }

    m_ulLength   += static_cast<size_t>(lLen);
    m_ulPosition += static_cast<size_t>(lLen);
}

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