PoDoFo::PdfStream Class Reference

#include <PdfStream.h>

Inheritance diagram for PoDoFo::PdfStream:

PoDoFo::PdfFileStream PoDoFo::PdfMemStream

List of all members.

Public Member Functions

 PdfStream (PdfObject *pParent)
virtual void Write (PdfOutputDevice *pDevice, PdfEncrypt *pEncrypt=NULL)=0
void Set (const char *szBuffer, long lLen, const TVecFilters &vecFilters)
void Set (const char *szBuffer, long lLen)
void Set (PdfInputStream *pStream)
void Set (PdfInputStream *pStream, const TVecFilters &vecFilters)
void Set (const char *pszString)
void SetRawData (PdfInputStream *pStream, 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 ()
virtual unsigned long GetLength () const =0
virtual void GetCopy (char **pBuffer, long *lLen) const =0
void GetFilteredCopy (char **pBuffer, long *lLen) const
void GetFilteredCopy (PdfOutputStream *pStream) const
const PdfStreamoperator= (const PdfStream &rhs)

Protected Member Functions

virtual const char * GetInternalBuffer () const =0
virtual unsigned long GetInternalBufferSize () const =0
virtual void BeginAppendImpl (const TVecFilters &vecFilters)=0
virtual void AppendImpl (const char *pszString, size_t lLen)=0
virtual void EndAppendImpl ()=0


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.

You have to use a concrete implementation of a stream, which can be retrieved from a StreamFactory.

See also:
PdfVecObjects

PdfMemoryStream

PdfFileStream


Constructor & Destructor Documentation

PoDoFo::PdfStream::PdfStream ( PdfObject pParent  ) 

Create a new PdfStream 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:
pParent parent object


Member Function Documentation

void PoDoFo::PdfStream::Append ( const std::string &  sString  )  [inline]

Append to the current stream contents.

Make sure BeginAppend has been called before.

Parameters:
sString a std::string containing ASCII text data
See also:
BeginAppend

EndAppend

void PoDoFo::PdfStream::Append ( const char *  pszString  )  [inline]

Append a null-terminated string to the current stream contents.

Make sure BeginAppend has been called before.

Parameters:
pszString a zero terminated string buffer containing only ASCII text data
See also:
BeginAppend

EndAppend

void PoDoFo::PdfStream::Append ( const char *  pszString,
size_t  lLen 
) [inline]

Append a binary buffer to the current stream contents.

Make sure BeginAppend has been called before.

Parameters:
pszString a buffer
lLen length of the buffer
See also:
BeginAppend

EndAppend

virtual void PoDoFo::PdfStream::AppendImpl ( const char *  pszString,
size_t  lLen 
) [protected, pure virtual]

Append a binary buffer to the current stream contents.

Parameters:
pszString a buffer
lLen length of the buffer
See also:
BeginAppend

Append

EndAppend

Implemented in PoDoFo::PdfFileStream, and PoDoFo::PdfMemStream.

void PoDoFo::PdfStream::BeginAppend ( const TVecFilters &  vecFilters,
bool  bClearExisting = true,
bool  bDeleteFilters = true 
)

Start appending data to this stream. This method has to be called before any of the append methods.

Use PdfFilterFactory::CreateFilterList if you want to use the contents of the stream dictionary's existing filter key.

Parameters:
vecFilters a list of filters to use when appending data
bClearExisting if true any existing stream contents will be cleared.
bDeleteFilters if true existing filter keys are deleted if an empty list of filters is passed (required for SetRawData)
See also:
Append

EndAppend

void PoDoFo::PdfStream::BeginAppend ( bool  bClearExisting = true  ) 

Start appending data to this stream.

This method has to be called before any of the append methods. All appended data will be flate decoded!

Parameters:
bClearExisting if true any existing stream contents will be cleared.
See also:
Append

EndAppend

virtual void PoDoFo::PdfStream::BeginAppendImpl ( const TVecFilters &  vecFilters  )  [protected, pure virtual]

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

Use PdfFilterFactory::CreateFilterList if you want to use the contents of the stream dictionary's existing filter key.

Parameters:
vecFilters use this filters to encode any data written to the stream.

Implemented in PoDoFo::PdfFileStream, and PoDoFo::PdfMemStream.

void PoDoFo::PdfStream::EndAppend (  ) 

Finish appending data to this stream. BeginAppend() has to be called before this method.

See also:
BeginAppend

Append

virtual void PoDoFo::PdfStream::EndAppendImpl (  )  [protected, pure virtual]

Finish appending data to the stream

Implemented in PoDoFo::PdfFileStream, and PoDoFo::PdfMemStream.

virtual void PoDoFo::PdfStream::GetCopy ( char **  pBuffer,
long *  lLen 
) const [pure 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 free() the buffer.

Parameters:
pBuffer pointer to the buffer
lLen pointer to the buffer length

Implemented in PoDoFo::PdfFileStream, and PoDoFo::PdfMemStream.

void PoDoFo::PdfStream::GetFilteredCopy ( PdfOutputStream pStream  )  const

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

Parameters:
pStream filtered data is written to this stream.

void PoDoFo::PdfStream::GetFilteredCopy ( char **  pBuffer,
long *  lLen 
) const

Get a malloced buffer of the current stream which has been filtered by all filters as specified in the dictionary's /Filter key. For example, if the stream is Flate compressed, the buffer returned from this method will have been decompressed.

The caller has to free() the buffer.

Parameters:
pBuffer pointer to the buffer
lLen pointer to the buffer length

virtual const char* PoDoFo::PdfStream::GetInternalBuffer (  )  const [protected, pure virtual]

Required for the GetFilteredCopy implementation

Returns:
a handle to the internal buffer

Implemented in PoDoFo::PdfFileStream, and PoDoFo::PdfMemStream.

virtual unsigned long PoDoFo::PdfStream::GetInternalBufferSize (  )  const [protected, pure virtual]

Required for the GetFilteredCopy implementation

Returns:
the size of the internal buffer

Implemented in PoDoFo::PdfFileStream, and PoDoFo::PdfMemStream.

virtual unsigned long PoDoFo::PdfStream::GetLength (  )  const [pure virtual]

Get the stream's length with all filters applied (eg if the stream is Flate compressed, the length of the compressed data stream).

Returns:
the length of the internal buffer

Implemented in PoDoFo::PdfFileStream, and PoDoFo::PdfMemStream.

const PdfStream & PoDoFo::PdfStream::operator= ( const PdfStream rhs  ) 

Create a copy of a PdfStream object

Parameters:
rhs the object to clone
Returns:
a reference to this object

Reimplemented in PoDoFo::PdfMemStream.

void PoDoFo::PdfStream::Set ( const char *  pszString  )  [inline]

Set a null-terminated char* buffer as the streams contents.

The string will be copied into a newly allocated buffer.

Parameters:
pszString a zero terminated string buffer containing only ASCII text data

void PoDoFo::PdfStream::Set ( PdfInputStream pStream,
const TVecFilters &  vecFilters 
)

Set a binary buffer whose contents are read from a PdfInputStream

Use PdfFilterFactory::CreateFilterList if you want to use the contents of the stream dictionary's existing filter key.

Parameters:
pStream read stream contents from this PdfInputStream
vecFilters a list of filters to use when appending data

void PoDoFo::PdfStream::Set ( PdfInputStream pStream  ) 

Set a binary buffer whose contents are read from a PdfInputStream All data will be flate encoded.

Parameters:
pStream read stream contents from this PdfInputStream

void PoDoFo::PdfStream::Set ( const char *  szBuffer,
long  lLen 
)

Set a binary buffer as stream data. All data will be flate encoded.

Parameters:
szBuffer buffer containing the stream data
lLen length of the buffer

void PoDoFo::PdfStream::Set ( const char *  szBuffer,
long  lLen,
const TVecFilters &  vecFilters 
)

Set a binary buffer as stream data.

Use PdfFilterFactory::CreateFilterList if you want to use the contents of the stream dictionary's existing filter key.

Parameters:
szBuffer buffer containing the stream data
lLen length of the buffer
vecFilters a list of filters to use when appending data

void PoDoFo::PdfStream::SetRawData ( PdfInputStream pStream,
long  lLen = -1 
)

Sets raw data for this filter which is read from an input stream. This method does neither encode nor decode the read data. The filters of the object are not modified and the data is expected to be encoded as stated by the /Filters key in the streams object.

Parameters:
pStream read data from this input stream
lLen read excactly lLen bytes from the input stream if lLen = -1 read until the end of the input stream was reached.

virtual void PoDoFo::PdfStream::Write ( PdfOutputDevice pDevice,
PdfEncrypt pEncrypt = NULL 
) [pure virtual]

Write the stream to an output device

Parameters:
pDevice write to this outputdevice.
pEncrypt encrypt stream data using this object

Implemented in PoDoFo::PdfFileStream, and PoDoFo::PdfMemStream.


Generated on Sat May 2 02:53:23 2009 for PoDoFo by  doxygen 1.5.7.1