PoDoFo  1.0.0-dev
Public Member Functions | Friends | List of all members
PoDoFo::PdfObjectStream Class Referencefinal

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

#include <PdfObjectStream.h>

Public Member Functions

PdfObjectOutputStream GetOutputStreamRaw (bool append=false)
 
PdfObjectOutputStream GetOutputStreamRaw (const PdfFilterList &filters, bool append=false)
 
PdfObjectOutputStream GetOutputStream (bool append=false)
 
PdfObjectOutputStream GetOutputStream (const PdfFilterList &filters, bool append=false)
 
PdfObjectInputStream GetInputStream (bool raw=false) const
 
void SetData (const bufferview &buffer, bool raw=false)
 Set the data contents copying from a buffer All data will be Flate-encoded. More...
 
void SetData (const bufferview &buffer, const PdfFilterList &filters, bool raw=false)
 Set the data contents copying from a buffer. More...
 
void SetData (InputStream &stream, bool raw=false)
 Set the data contents reading from an InputStream All data will be Flate-encoded. More...
 
void SetData (InputStream &stream, const PdfFilterList &filters, bool raw=false)
 Set the data contents reading from an InputStream. More...
 
charbuff GetCopy (bool raw=false) const
 Get an unwrapped copy of the stream, unpacking non media filters. More...
 
charbuff GetCopySafe () const
 Get an unwrapped copy of the stream, unpacking non media filters.
 
void CopyTo (charbuff &buffer, bool raw=false) const
 Unwrap the stream to the given buffer, unpacking non media filters. More...
 
void CopyToSafe (charbuff &buffer) const
 Unwrap the stream to the given buffer, unpacking non media filters.
 
void CopyTo (OutputStream &stream, bool raw=false) const
 Unwrap the stream and write it to the given stream, unpacking non media filters. More...
 
void CopyToSafe (OutputStream &stream) const
 Unwrap the stream and write it to the given stream, unpacking non media filters.
 
void Unwrap ()
 Unpack non media filters.
 
void Clear ()
 Clear the stream and reset filters.
 
size_t GetLength () const
 Get the stream's length with all filters applied (e.g. More...
 
const PdfFilterList & GetFilters ()
 
PdfObjectStreamoperator= (const PdfObjectStream &rhs)
 Create a copy of a PdfObjectStream object. More...
 
PdfObjectStreamoperator= (PdfObjectStream &&rhs) noexcept
 
const PdfObjectStreamProvider & GetProvider () const
 
const PdfObjectGetParent () const
 
PdfObjectGetParent ()
 

Friends

class PdfObject
 
class PdfObjectInputStream
 
class PdfObjectOutputStream
 

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
PdfIndirectObjectList
PdfMemoryObjectStream
PdfFileObjectStream

Member Function Documentation

◆ CopyTo() [1/2]

void PdfObjectStream::CopyTo ( charbuff buffer,
bool  raw = false 
) const

Unwrap the stream to the given buffer, unpacking non media filters.

Remarks
throws if the stream contains media filters, like DCTDecode. It clears the buffer before copying

◆ CopyTo() [2/2]

void PdfObjectStream::CopyTo ( OutputStream stream,
bool  raw = false 
) const

Unwrap the stream and write it to the given stream, unpacking non media filters.

Remarks
throws if the stream contains media filters, like DCTDecode. It clears the buffer before copying

◆ GetCopy()

charbuff PdfObjectStream::GetCopy ( bool  raw = false) const

Get an unwrapped copy of the stream, unpacking non media filters.

Remarks
throws if the stream contains media filters, like DCTDecode

◆ GetLength()

size_t PdfObjectStream::GetLength ( ) const

Get the stream's length with all filters applied (e.g.

if the stream is Flate-compressed, the length of the compressed data stream).

Returns
the length of the internal buffer

◆ operator=()

PdfObjectStream & PdfObjectStream::operator= ( const PdfObjectStream rhs)

Create a copy of a PdfObjectStream object.

Parameters
rhsthe object to clone
Returns
a reference to this object

◆ SetData() [1/4]

void PdfObjectStream::SetData ( const bufferview buffer,
bool  raw = false 
)

Set the data contents copying from a buffer All data will be Flate-encoded.

Parameters
bufferbuffer containing the stream data
rawif true the data will be set without applying any filter, clearing the filters list unconditionally

◆ SetData() [2/4]

void PdfObjectStream::SetData ( const bufferview buffer,
const PdfFilterList &  filters,
bool  raw = false 
)

Set the data contents copying from a buffer.

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

Parameters
bufferbuffer containing the stream data
filtersa list of filters to use when appending data
rawif true the data will be set without applying any filter, setting the supplied filters list unconditionally

◆ SetData() [3/4]

void PdfObjectStream::SetData ( InputStream stream,
bool  raw = false 
)

Set the data contents reading from an InputStream All data will be Flate-encoded.

Parameters
streamread stream contents from this InputStream
rawif true the data will be set without applying any filter, clearing the filters list unconditionally

◆ SetData() [4/4]

void PdfObjectStream::SetData ( InputStream stream,
const PdfFilterList &  filters,
bool  raw = false 
)

Set the data contents reading from an InputStream.

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

Parameters
streamread stream contents from this InputStream
filtersa list of filters to use when appending data
rawif true the data will be set without applying any filter, setting the supplied filters list unconditionally

The documentation for this class was generated from the following files: