Foxit PDF SDK
foxit::pdf::objects::PDFStream Class Reference
Inheritance diagram for foxit::pdf::objects::PDFStream:
foxit::pdf::objects::PDFObject

Public Types

enum  Filter {
  e_Unknown = -1, e_NoneDecode = 0, e_ASCIIHexDecode = 1, e_ASCII85Decode = 2,
  e_LZWDecode = 3, e_FlateDecode = 4, e_RunLengthDecode = 5, e_CCITTFaxDecode = 6,
  e_JBIG2Decode = 7, e_DCTDecode = 8, e_JPXDecode = 9, e_Crypt = 10
}
 Enumeration for stream filter type. More...
 
- Public Types inherited from foxit::pdf::objects::PDFObject
enum  Type {
  e_InvalidType = 0, e_Boolean = 1, e_Number = 2, e_String = 3,
  e_Name = 4, e_Array = 5, e_Dictionary = 6, e_Stream = 7,
  e_Null = 8, e_Reference = 9
}
 Enumeration for PDF object type. More...
 

Public Member Functions

common::file::ReaderCallbackExportData (bool is_raw_data)
 Export stream data. More...
 
bool GetData (bool is_raw_data, size_t size, void *out_buffer)
 Get stream data. More...
 
uint64 GetDataSize (bool is_raw_data)
 Get the size of stream data, in bytes. More...
 
PDFDictionaryGetDictionary ()
 Get the PDF dictionary object associated to current PDF stream object. More...
 
Filter GetStreamFilter ()
 Get the type of stream filter which indicate how the stream data must be decoded before the data is used. More...
 
void ImportData (common::file::ReaderCallback *file_read, Filter stream_filter)
 Import stream data. More...
 
void SetData (const void *buffer, size_t size)
 Set stream data. More...
 
- Public Member Functions inherited from foxit::pdf::objects::PDFObject
PDFObjectCloneObject () const
 Clone current PDF object and get the cloned PDF object. More...
 
PDFObjectDeepCloneObject () const
 Clone current PDF object and get the cloned PDF object. More...
 
PDFArrayGetArray ()
 Get the PDF array object of current PDF object. More...
 
bool GetBoolean () const
 Get the boolean value of current PDF object. More...
 
DateTime GetDateTime () const
 Get the date time value of current PDF object. More...
 
PDFDictionaryGetDict ()
 Get the PDF dictionary object of current PDF object. More...
 
PDFObjectGetDirectObject () const
 Get the direct object of current PDF object. More...
 
float GetFloat () const
 Get the float value of current PDF object. More...
 
int GetInteger () const
 Get the integer value of current PDF object. More...
 
Matrix GetMatrix () const
 Get the matrix value of current PDF object. More...
 
String GetName () const
 Get the name value of current PDF object. More...
 
uint32 GetObjNum () const
 Get the indirect object number of current PDF object. More...
 
RectF GetRect () const
 Get the rectangle value of current PDF object. More...
 
PDFStreamGetStream ()
 Get the PDF stream object of current PDF object. More...
 
String GetString () const
 Get the string value of current PDF object. More...
 
Type GetType () const
 Get the type of current PDF object. More...
 
WString GetWideString () const
 Get the wide string value of current PDF object. More...
 
bool IsIdentical (PDFObject *pdf_obj) const
 Check if input PDF object is identical with current PDF object. More...
 
void Release ()
 Release a newly created PDF object or a clone PDF object, which is not related to PDF document or other PDF object and will not be used any more. More...
 

Static Public Member Functions

static PDFStreamCreate (PDFDictionary *dictionary)
 Create a new stream object based on a dictionary. More...
 
- Static Public Member Functions inherited from foxit::pdf::objects::PDFObject
static PDFObjectCreateFromBoolean (bool boolean_value)
 Create a PDF object from a boolean value. More...
 
static PDFObjectCreateFromDateTime (const DateTime &date_time)
 Create a PDF object from date time. More...
 
static PDFObjectCreateFromFloat (float float_value)
 Create a PDF object from a float number. More...
 
static PDFObjectCreateFromInteger (int integer_value)
 Create a PDF object from a integer number. More...
 
static PDFObjectCreateFromName (const char *name)
 Create a PDF object from a string which represents a name. More...
 
static PDFObjectCreateFromString (const wchar_t *string_value)
 Create a PDF object from string. More...
 
static PDFObjectCreateReference (PDFDoc document, uint32 object_number)
 Create a reference for an indirect object. More...
 

Detailed Description

A PDF stream object consists of a direct dictionary object and stream data. For more details, please refer to Section 3.2.7 "Stream Objects" in <PDF Reference 1.7>.
Class objects::PDFStream is derived from PDFObject and offers functions to create a new PDF stream object and get/set stream data.

See also
PDFObject

Member Enumeration Documentation

◆ Filter

Enumeration for stream filter type.

Values of this enumeration should be used alone. The stream filter indicates how the data in the PDF stream must be decoded before the data is used.

Enumerator
e_Unknown 

Unknown filter type.

e_NoneDecode 

No need to decode the stream data.

e_ASCIIHexDecode 

Filter type: ASCIIHexDecode, which means to decode data encoded in an ASCII hexadecimal representation, reproducing the original binary data.

e_ASCII85Decode 

Filter type: ASCII85Decode, which means to decode data encoded in an ASCII base-85 representation, reproducing the original binary data.

e_LZWDecode 

Filter type: LZWDecode, which means to decompress data encoded using the LZW (Lempel-Ziv-Welch) adaptive compression method, reproducing the original text or binary data.

e_FlateDecode 

Filter type: FlateDecode, which means to decompress data encoded using the zlib/deflate compression method, reproducing the original text or binary data.

e_RunLengthDecode 

Filter type: RunLengthDecode, which means to decompress data encoded using a byte-oriented run-length encoding algorithm, reproducing the original text or binary data (typically monochrome image data, or any data that contains frequent long runs of a single byte value).

e_CCITTFaxDecode 

Filter type: CCITTFaxDecode, which means to decompress data encoded using the CCITT facsimile standard, reproducing the original data (typically monochrome image data at 1 bit per pixel).

e_JBIG2Decode 

Filter type: JBIG2Decode, which means to decompress data encoded using the JBIG2 standard, reproducing the original monochrome (1 bit per pixel) image data (or an approximation of that data).

e_DCTDecode 

Filter type: DCTDecode, which means to decompress data encoded using a DCT (discrete cosine transform) technique based on the JPEG standard, reproducing image sample data that approximates the original data.

e_JPXDecode 

Filter type: JPXDecode, which means to decompress data encoded using the wavelet-based JPEG2000 standard, reproducing the original image data.

e_Crypt 

Filter type: Crypt, which means to decrypt data encrypted by a security handler, reproducing the original data as it was before encryption.

Member Function Documentation

◆ Create()

static PDFStream* foxit::pdf::objects::PDFStream::Create ( PDFDictionary dictionary)
static

Create a new stream object based on a dictionary.

Parameters
[in]dictionaryA PDF dictionary object:
  • If this is NULL, PDF stream object will be created based on an empty PDF dictionary.
  • If this is not NULL, after creating PDF stream object successfully, do not call PDFObject::Release for this PDF dictionary object.
Returns
A new PDFStream object. Please call function PDFObject::Release to release the created object if it has not been added/set into PDF document or other PDF object and will not be used any more.

◆ ExportData()

common::file::ReaderCallback* foxit::pdf::objects::PDFStream::ExportData ( bool  is_raw_data)

Export stream data.

This function provides an efficient way to get the stream data, especially for large stream data.

Parameters
[in]is_raw_dataA boolean value that indicates whether to get raw data or not: true means to get raw data, and false means to get decoded data (original data).
Returns
A common::file::ReaderCallback object which can be used to read stream data. Please remeber to use callback function Relase() of the returned common::file::ReaderCallback object to release this common::file::ReaderCallback object when not use it any more.
Note
If current stream object is released or related PDF document is closed, do not use returned common::file::ReaderCallback object any more; otherwise, unexpected error or crash will occur.

◆ GetData()

bool foxit::pdf::objects::PDFStream::GetData ( bool  is_raw_data,
size_t  size,
void *  out_buffer 
)

Get stream data.

When calling this function, user should pass a memory block with enough size to retrieve data. User is recommended to call function PDFStream::GetDataSize (with same parameter is_raw_data) to get the expected size, then prepare the memory block, and then call this function to get data.

Parameters
[in]is_raw_dataA boolean value that indicates whether to get raw data or not: true means to get raw data, and false means to get decoded data (original data).
[in]sizeSize of parameter out_buffer, in bytes. It should be equal to or larger than the actual data size.
[out]out_bufferA memory block (with enough size) used as output parameter that receives the stream data. It should not be NULL.
Returns
true means success, while false means failed.

◆ GetDataSize()

uint64 foxit::pdf::objects::PDFStream::GetDataSize ( bool  is_raw_data)

Get the size of stream data, in bytes.

Parameters
[in]is_raw_dataA boolean value that indicates whether to get raw data or not: true means to get raw data, and false means to get decoded data (original data).
Returns
The data size, in bytes.

◆ GetDictionary()

PDFDictionary* foxit::pdf::objects::PDFStream::GetDictionary ( )

Get the PDF dictionary object associated to current PDF stream object.

Returns
The stream dictionary.

◆ GetStreamFilter()

Filter foxit::pdf::objects::PDFStream::GetStreamFilter ( )

Get the type of stream filter which indicate how the stream data must be decoded before the data is used.

Returns
The type of stream filter. Please refer to values starting from PDFStream::e_Unknown and this would be one of these values.

◆ ImportData()

void foxit::pdf::objects::PDFStream::ImportData ( common::file::ReaderCallback file_read,
Filter  stream_filter 
)

Import stream data.

Parameters
[in]file_readA common::file::ReaderCallback object implemented by user. Foxit PDF SDK will use this to read stream data and set to current PDF stream object. User should keep this callback valid until the related PDF document is closed or current stream object is released because of useless.
[in]stream_filterType of stream filter, which specifies how to decode the data which is read through parameter file_read. Please refer to values starting from PDFStream::e_NoneDecode and this should be one of these values except PDFStream::e_Unknown.
Returns
None.

◆ SetData()

void foxit::pdf::objects::PDFStream::SetData ( const void *  buffer,
size_t  size 
)

Set stream data.

Parameters
[in]bufferA memory block that represents the new stream data to be set.
[in]sizeSize of parameter buffer, in bytes.
Returns
None.