PoDoFo 0.9.6
|
#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) |
Static Public Attributes | |
static enum EPdfFilter | eDefaultFilter |
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 | ) |
|
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 |
|
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 |
|
inline |
Append to the current stream contents.
Make sure BeginAppend() has been called before.
sString | a std::string containing only ASCII text data |
|
protectedpure virtual |
Append a binary buffer to the current stream contents.
pszString | a buffer |
lLen | length of the buffer |
Implemented in PoDoFo::PdfFileStream, and PoDoFo::PdfMemStream.
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-encoded.
bClearExisting | if true any existing stream contents will be cleared. |
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()) |
|
protectedpure 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 these 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.
|
protectedpure virtual |
Finish appending data to the stream
Implemented in PoDoFo::PdfFileStream, and PoDoFo::PdfMemStream.
|
pure virtual |
Get a malloc()'d 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.
pBuffer | pointer to the buffer |
lLen | pointer to the buffer length |
Implemented in PoDoFo::PdfFileStream, and PoDoFo::PdfMemStream.
|
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 malloc()'d 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 podofo_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. |
|
protectedpure virtual |
Required for the GetFilteredCopy() implementation
Implemented in PoDoFo::PdfFileStream, and PoDoFo::PdfMemStream.
|
protectedpure virtual |
Required for the GetFilteredCopy() implementation
Implemented in PoDoFo::PdfFileStream, and PoDoFo::PdfMemStream.
|
pure virtual |
Get the stream's length with all filters applied (e.g. if the stream is Flate-compressed, the length of the compressed data stream).
Implemented in PoDoFo::PdfFileStream, and PoDoFo::PdfMemStream.
|
inline |
Create a copy of a PdfStream object
rhs | the object to clone |
|
inline |
Set a null-terminated char* buffer as the stream's 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::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 | ( | 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 | ( | 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::SetRawData | ( | PdfInputStream * | pStream, |
pdf_long | lLen = -1 |
||
) |
Sets raw data for this stream 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 encoded as stated by the /Filters key in the stream's object.
pStream | read data from this input stream |
lLen | read exactly lLen bytes from the input stream, if lLen = -1 read until the end of the input stream was reached. |
|
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.
|
static |
The default filter to use when changing the stream content. It's a static member and applies to all newly created/changed streams. The default value is ePdfFilter_FlateDecode.