pdfmm 0.9.20
Static Public Member Functions | List of all members
mm::PdfFilterFactory Class Referencefinal

#include <PdfFilter.h>

Static Public Member Functions

static std::unique_ptr< PdfFilterCreate (const PdfFilterType filterType)
 
static std::unique_ptr< PdfOutputStreamCreateEncodeStream (const PdfFilterList &filters, PdfOutputStream &stream)
 
static std::unique_ptr< PdfOutputStreamCreateDecodeStream (const PdfFilterList &filters, PdfOutputStream &stream, const PdfDictionary *dictionary=nullptr)
 
static PdfFilterType FilterNameToType (const PdfName &name, bool supportShortNames=true)
 
static const char * FilterTypeToName (PdfFilterType filterType)
 
static PdfFilterList CreateFilterList (const PdfObject &filtersObj)
 

Detailed Description

A factory to create a filter object for a filter type (as GetType() gives) from the PdfFilterType enum. All filters should be created using this factory.

Member Function Documentation

◆ Create()

std::unique_ptr< PdfFilter > PdfFilterFactory::Create ( const PdfFilterType  filterType)
static

Create a filter from an enum.

Ownership is transferred to the caller, who should let the unique_ptr the filter is returned in take care of freeing it when they're done with it.

Parameters
filterTypereturn value of GetType() for filter to be created
Returns
a new PdfFilter allocated using new, or nullptr if no filter is available for this type.

◆ CreateDecodeStream()

unique_ptr< PdfOutputStream > PdfFilterFactory::CreateDecodeStream ( const PdfFilterList &  filters,
PdfOutputStream stream,
const PdfDictionary dictionary = nullptr 
)
static

Create a PdfOutputStream that applies a list of filters on all data written to it.

Parameters
filtersa list of filters
streamwrite all data to this PdfOutputStream after it has been decoded.
dictionarypointer to a dictionary that might contain additional parameters for stream decoding. This method will look for a key named DecodeParms in this dictionary and pass the information found in that dictionary to the filters.
Returns
a new PdfOutputStream that has to be deleted by the caller.
See also
PdfFilterFactory::CreateFilterList

◆ CreateEncodeStream()

unique_ptr< PdfOutputStream > PdfFilterFactory::CreateEncodeStream ( const PdfFilterList &  filters,
PdfOutputStream stream 
)
static

Create a PdfOutputStream that applies a list of filters on all data written to it.

Parameters
filtersa list of filters
streamwrite all data to this PdfOutputStream after it has been encoded
Returns
a new PdfOutputStream that has to be deleted by the caller.
See also
PdfFilterFactory::CreateFilterList

◆ CreateFilterList()

PdfFilterList PdfFilterFactory::CreateFilterList ( const PdfObject filtersObj)
static

The passed PdfObject has to be a dictionary with a Filters key, a (possibly empty) array of filter names or a filter name.

Parameters
filtersObjmust define a filter or list of filters (can be empty, although then you should use TVecFilters' default)
Returns
a list of filters

◆ FilterNameToType()

PdfFilterType PdfFilterFactory::FilterNameToType ( const PdfName name,
bool  supportShortNames = true 
)
static

Converts a filter name to the corresponding enum

Parameters
nameof the filter without leading
supportShortNamesThe PDF Reference supports several short names for filters (e.g. AHx for AsciiHexDecode), if true support for these short names will be enabled. This is often used in inline images.
Returns
the filter as enum

◆ FilterTypeToName()

const char * PdfFilterFactory::FilterTypeToName ( PdfFilterType  filterType)
static

Converts a filter type enum to the corresponding PdfName

Parameters
filterTypea filter type
Returns
the filter as name