PoDoFo  0.9.4
Public Member Functions | Protected Member Functions | List of all members
PoDoFo::PdfFileStream Class Reference

#include <PdfFileStream.h>

Inheritance diagram for PoDoFo::PdfFileStream:
PoDoFo::PdfStream

Public Member Functions

 PdfFileStream (PdfObject *pParent, PdfOutputDevice *pDevice)
 
void SetEncrypted (PdfEncrypt *pEncrypt)
 
virtual void Write (PdfOutputDevice *pDevice, PdfEncrypt *pEncrypt=NULL)
 
virtual void GetCopy (char **pBuffer, pdf_long *lLen) const
 
virtual void GetCopy (PdfOutputStream *pStream) const
 
virtual pdf_long GetLength () const
 
- Public Member Functions inherited from PoDoFo::PdfStream
 PdfStream (PdfObject *pParent)
 
void Set (const char *szBuffer, pdf_long lLen, const TVecFilters &vecFilters)
 
void Set (const char *szBuffer, pdf_long lLen)
 
void Set (PdfInputStream *pStream)
 
void Set (PdfInputStream *pStream, const TVecFilters &vecFilters)
 
void Set (const char *pszString)
 
void SetRawData (PdfInputStream *pStream, pdf_long lLen=-1)
 
void BeginAppend (bool bClearExisting=true)
 
void BeginAppend (const TVecFilters &vecFilters, bool bClearExisting=true, bool bDeleteFilters=true)
 
void Append (const char *pszString, size_t lLen)
 
void Append (const char *pszString)
 
void Append (const std::string &sString)
 
void EndAppend ()
 
bool IsAppending () const
 
void GetFilteredCopy (char **pBuffer, pdf_long *lLen) const
 
void GetFilteredCopy (PdfOutputStream *pStream) const
 
const PdfStreamoperator= (const PdfStream &rhs)
 

Protected Member Functions

virtual const char * GetInternalBuffer () const
 
virtual pdf_long GetInternalBufferSize () const
 
virtual void BeginAppendImpl (const TVecFilters &vecFilters)
 
virtual void AppendImpl (const char *pszString, size_t lLen)
 
virtual void EndAppendImpl ()
 

Detailed Description

A PDF stream can be appended to any PdfObject and can contain arbitrary data.

Most of the time it will contain either drawing commands to draw onto a page or binary data like a font or an image.

A PdfFileStream writes all data directly to an output device without keeping it in memory. PdfFileStream is used automatically when creating PDF files using PdfImmediateWriter.

See also
PdfVecObjects
PdfStream
PdfMemoryStream
PdfFileStream

Constructor & Destructor Documentation

PoDoFo::PdfFileStream::PdfFileStream ( PdfObject pParent,
PdfOutputDevice pDevice 
)

Create a new PdfFileStream object which has a parent PdfObject. The stream will be deleted along with the parent. This constructor will be called by PdfObject::Stream() for you.

Parameters
pParentparent object
pDeviceoutput device

Member Function Documentation

void PoDoFo::PdfFileStream::AppendImpl ( const char *  pszString,
size_t  lLen 
)
protectedvirtual

Append a binary buffer to the current stream contents.

Parameters
pszStringa buffer
lLenlength of the buffer
See also
BeginAppend
Append
EndAppend

Implements PoDoFo::PdfStream.

void PoDoFo::PdfFileStream::BeginAppendImpl ( const TVecFilters &  vecFilters)
protectedvirtual

Begin appending data to this stream. Clears the current stream contents.

Parameters
vecFiltersuse this filters to encode any data written to the stream.

Implements PoDoFo::PdfStream.

void PoDoFo::PdfFileStream::EndAppendImpl ( )
protectedvirtual

Finish appending data to the stream

Implements PoDoFo::PdfStream.

void PoDoFo::PdfFileStream::GetCopy ( char **  pBuffer,
pdf_long *  lLen 
) const
virtual

Get a malloced buffer of the current stream. No filters will be applied to the buffer, so if the stream is Flate compressed the compressed copy will be returned.

The caller has to podofo_free() the buffer.

This is currently not implemented for PdfFileStreams and will raise an ePdfError_InternalLogic exception

Parameters
pBufferpointer to the buffer address (output parameter)
lLenpointer to the buffer length (output parameter)

Implements PoDoFo::PdfStream.

void PoDoFo::PdfFileStream::GetCopy ( PdfOutputStream pStream) const
virtual

Get a copy of a the stream and write it to a PdfOutputStream

Parameters
pStreamdata is written to this stream.

Implements PoDoFo::PdfStream.

const char * PoDoFo::PdfFileStream::GetInternalBuffer ( ) const
inlineprotectedvirtual

Required for the GetFilteredCopy implementation

Returns
a handle to the internal buffer

Implements PoDoFo::PdfStream.

pdf_long PoDoFo::PdfFileStream::GetInternalBufferSize ( ) const
inlineprotectedvirtual

Required for the GetFilteredCopy implementation

Returns
the size of the internal buffer

Implements PoDoFo::PdfStream.

pdf_long PoDoFo::PdfFileStream::GetLength ( ) const
inlinevirtual

Get the streams length with all filters applied (eg the compressed length of a Flate compressed stream).

Returns
the length of the stream with all filters applied

Implements PoDoFo::PdfStream.

void PoDoFo::PdfFileStream::SetEncrypted ( PdfEncrypt pEncrypt)

Set an encryption object which is used to encrypt all data written to this stream.

Parameters
pEncryptan encryption object or NULL if no encryption should be done
void PoDoFo::PdfFileStream::Write ( PdfOutputDevice pDevice,
PdfEncrypt pEncrypt = NULL 
)
virtual

Write the stream to an output device

Parameters
pDevicewrite to this outputdevice.
pEncryptencrypt stream data using this object

Implements PoDoFo::PdfStream.