|
pdfmm 0.9.20
|
#include <PdfStream.h>
Public Member Functions | |
| virtual void | Write (PdfOutputDevice &device, const PdfEncrypt *encrypt)=0 |
| void | Set (const std::string_view &view, const PdfFilterList &filters) |
| void | Set (const char *buffer, size_t len, const PdfFilterList &filters) |
| void | Set (const std::string_view &view) |
| void | Set (const char *buffer, size_t len) |
| void | Set (PdfInputStream &stream) |
| void | Set (PdfInputStream &stream, const PdfFilterList &filters) |
| void | SetRawData (PdfInputStream &stream, ssize_t len=-1) |
| void | BeginAppend (bool clearExisting=true) |
| void | BeginAppend (const PdfFilterList &filters, bool clearExisting=true, bool deleteFilters=true) |
| PdfStream & | Append (const std::string_view &view) |
| PdfStream & | Append (const char *buffer, size_t len) |
| void | EndAppend () |
| bool | IsAppending () const |
| virtual size_t | GetLength () const =0 |
| virtual void | GetCopy (std::unique_ptr< char[]> &buffer, size_t &len) const =0 |
| virtual void | GetCopy (PdfOutputStream &stream) const =0 |
| void | GetFilteredCopy (std::unique_ptr< char[]> &buffer, size_t &len) const |
| void | GetFilteredCopy (PdfOutputStream &stream) const |
| const PdfStream & | operator= (const PdfStream &rhs) |
Static Public Attributes | |
| static enum PdfFilterType | DefaultFilter |
Protected Member Functions | |
| PdfStream (PdfObject &parent) | |
| virtual const char * | GetInternalBuffer () const =0 |
| virtual size_t | GetInternalBufferSize () const =0 |
| virtual void | BeginAppendImpl (const PdfFilterList &filters)=0 |
| virtual void | AppendImpl (const char *data, size_t len)=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.
|
protected |
| PdfStream & PdfStream::Append | ( | const char * | buffer, |
| size_t | len | ||
| ) |
Append a binary buffer to the current stream contents.
Make sure BeginAppend() has been called before.
| buffer | a buffer |
| len | size of the buffer |
| PdfStream & mm::PdfStream::Append | ( | const std::string_view & | view | ) |
Append a binary buffer to the current stream contents.
Make sure BeginAppend() has been called before.
| view | a buffer |
|
protectedpure virtual |
Append a binary buffer to the current stream contents.
| data | a buffer |
| len | length of the buffer |
Implemented in mm::PdfFileStream, and mm::PdfMemStream.
| void PdfStream::BeginAppend | ( | bool | clearExisting = true | ) |
| void PdfStream::BeginAppend | ( | const PdfFilterList & | filters, |
| bool | clearExisting = true, |
||
| bool | deleteFilters = 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.
| filters | 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.
| filters | use these filters to encode any data written to the stream. |
Implemented in mm::PdfFileStream, and mm::PdfMemStream.
| void 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 mm::PdfFileStream, and mm::PdfMemStream.
|
pure virtual |
Get a copy of a the stream and write it to a PdfOutputStream
| stream | data is written to this stream. |
Implemented in mm::PdfFileStream, and mm::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 the buffer.
| buffer | pointer to the buffer |
| len | pointer to the buffer length |
Implemented in mm::PdfFileStream, and mm::PdfMemStream.
| void PdfStream::GetFilteredCopy | ( | PdfOutputStream & | stream | ) | const |
Get a filtered copy of a the stream and write it to a PdfOutputStream
| stream | filtered data is written to this stream. |
| void mm::PdfStream::GetFilteredCopy | ( | std::unique_ptr< char[]> & | buffer, |
| size_t & | len | ||
| ) | 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 the buffer.
| buffer | pointer to the buffer |
| len | pointer to the buffer length |
|
protectedpure virtual |
Required for the GetFilteredCopy() implementation
Implemented in mm::PdfFileStream, and mm::PdfMemStream.
|
protectedpure virtual |
Required for the GetFilteredCopy() implementation
Implemented in mm::PdfFileStream, and mm::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 mm::PdfFileStream, and mm::PdfMemStream.
|
inline |
Create a copy of a PdfStream object
| rhs | the object to clone |
| void PdfStream::Set | ( | const char * | buffer, |
| size_t | len | ||
| ) |
Set a binary buffer as stream data. All data will be Flate-encoded.
| buffer | buffer containing the stream data |
| len | length of the buffer |
| void PdfStream::Set | ( | const char * | buffer, |
| size_t | len, | ||
| const PdfFilterList & | filters | ||
| ) |
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.
| buffer | buffer containing the stream data |
| len | length of the buffer |
| filters | a list of filters to use when appending data |
| void mm::PdfStream::Set | ( | const std::string_view & | view | ) |
Set a binary buffer as stream data. All data will be Flate-encoded.
| view | buffer containing the stream data |
| void mm::PdfStream::Set | ( | const std::string_view & | view, |
| const PdfFilterList & | filters | ||
| ) |
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.
| view | buffer containing the stream data |
| filters | a list of filters to use when appending data |
| void PdfStream::Set | ( | PdfInputStream & | stream | ) |
Set a binary buffer whose contents are read from a PdfInputStream All data will be Flate-encoded.
| stream | read stream contents from this PdfInputStream |
| void PdfStream::Set | ( | PdfInputStream & | stream, |
| const PdfFilterList & | filters | ||
| ) |
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.
| stream | read stream contents from this PdfInputStream |
| filters | a list of filters to use when appending data |
| void PdfStream::SetRawData | ( | PdfInputStream & | stream, |
| ssize_t | len = -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.
| stream | read data from this input stream |
| len | read exactly len bytes from the input stream, if len = -1 read until the end of the input stream was reached. |
|
pure virtual |
Write the stream to an output device
| device | write to this outputdevice. |
| encrypt | encrypt stream data using this object |
Implemented in mm::PdfFileStream, and mm::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 PdfFilterType::FlateDecode.