PoDoFo
0.9.1
|
#include <PdfStream.h>
Public Member Functions | |
PdfStream (PdfObject *pParent) | |
virtual void | Write (PdfOutputDevice *pDevice, PdfEncrypt *pEncrypt=NULL)=0 |
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 |
virtual pdf_long | GetLength () const =0 |
virtual void | GetCopy (char **pBuffer, pdf_long *lLen) const =0 |
virtual void | GetCopy (PdfOutputStream *pStream) const =0 |
void | GetFilteredCopy (char **pBuffer, pdf_long *lLen) const |
void | GetFilteredCopy (PdfOutputStream *pStream) const |
const PdfStream & | operator= (const PdfStream &rhs) |
Protected Member Functions | |
virtual const char * | GetInternalBuffer () const =0 |
virtual pdf_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 |
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.
PoDoFo::PdfStream::PdfStream | ( | PdfObject * | pParent | ) |
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.
pszString | a buffer |
lLen | length of the buffer |
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.
pszString | a zero terminated string buffer containing only ASCII text data |
void PoDoFo::PdfStream::Append | ( | const std::string & | sString | ) | [inline] |
Append to the current stream contents.
Make sure BeginAppend has been called before.
sString | a std::string containing ASCII text data |
virtual void PoDoFo::PdfStream::AppendImpl | ( | const char * | pszString, |
size_t | lLen | ||
) | [protected, pure virtual] |
Append a binary buffer to the current stream contents.
pszString | a buffer |
lLen | length of the buffer |
Implemented in PoDoFo::PdfMemStream, and PoDoFo::PdfFileStream.
void PoDoFo::PdfStream::BeginAppend | ( | bool | bClearExisting = true | ) |
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.
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) |
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.
vecFilters | use this filters to encode any data written to the stream. |
Implemented in PoDoFo::PdfMemStream, and PoDoFo::PdfFileStream.
void PoDoFo::PdfStream::EndAppend | ( | ) |
Finish appending data to this stream. BeginAppend() has to be called before this method.
virtual void PoDoFo::PdfStream::EndAppendImpl | ( | ) | [protected, pure virtual] |
Finish appending data to the stream
Implemented in PoDoFo::PdfMemStream, and PoDoFo::PdfFileStream.
virtual void PoDoFo::PdfStream::GetCopy | ( | char ** | pBuffer, |
pdf_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.
pBuffer | pointer to the buffer |
lLen | pointer to the buffer length |
Implemented in PoDoFo::PdfFileStream, and PoDoFo::PdfMemStream.
virtual void PoDoFo::PdfStream::GetCopy | ( | PdfOutputStream * | pStream | ) | const [pure virtual] |
Get a copy of a the stream and write it to a PdfOutputStream
pStream | data is written to this stream. |
Implemented in PoDoFo::PdfFileStream, and PoDoFo::PdfMemStream.
void PoDoFo::PdfStream::GetFilteredCopy | ( | char ** | pBuffer, |
pdf_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.
pBuffer | pointer to the buffer |
lLen | pointer to the buffer length |
void PoDoFo::PdfStream::GetFilteredCopy | ( | PdfOutputStream * | pStream | ) | const |
Get a filtered copy of a the stream and write it to a PdfOutputStream
pStream | filtered data is written to this stream. |
virtual const char* PoDoFo::PdfStream::GetInternalBuffer | ( | ) | const [protected, pure virtual] |
Required for the GetFilteredCopy implementation
Implemented in PoDoFo::PdfMemStream, and PoDoFo::PdfFileStream.
virtual pdf_long PoDoFo::PdfStream::GetInternalBufferSize | ( | ) | const [protected, pure virtual] |
Required for the GetFilteredCopy implementation
Implemented in PoDoFo::PdfMemStream, and PoDoFo::PdfFileStream.
virtual pdf_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).
Implemented in PoDoFo::PdfMemStream, and PoDoFo::PdfFileStream.
bool PoDoFo::PdfStream::IsAppending | ( | ) | const [inline] |
Create a copy of a PdfStream object
rhs | the object to clone |
Reimplemented in PoDoFo::PdfMemStream.
void PoDoFo::PdfStream::Set | ( | const char * | szBuffer, |
pdf_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.
szBuffer | buffer containing the stream data |
lLen | length of the buffer |
vecFilters | a list of filters to use when appending data |
void PoDoFo::PdfStream::Set | ( | const char * | szBuffer, |
pdf_long | lLen | ||
) |
Set a binary buffer as stream data. All data will be flate encoded.
szBuffer | buffer containing the stream data |
lLen | length of the buffer |
void PoDoFo::PdfStream::Set | ( | PdfInputStream * | pStream | ) |
Set a binary buffer whose contents are read from a PdfInputStream All data will be flate encoded.
pStream | read stream contents from this PdfInputStream |
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.
pStream | read stream contents from this PdfInputStream |
vecFilters | a list of filters to use when appending data |
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.
pszString | a zero terminated string buffer containing only ASCII text data |
void PoDoFo::PdfStream::SetRawData | ( | PdfInputStream * | pStream, |
pdf_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.
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
pDevice | write to this outputdevice. |
pEncrypt | encrypt stream data using this object |
Implemented in PoDoFo::PdfFileStream, and PoDoFo::PdfMemStream.