PDFOptimizer Class Documentation

class PDFOptimizer

Namespace:datalogics_interface

Detailed Description

Implementation of the PDF Optimizer function.

Use the PDFOptimizer object to accumulate options for the Optimization, and to Optimize documents.

Constructor & Destructor Documentation

PDFOptimizer

PDFOptimizer()

Construct a CPDFOptimizer, with default Options.

~PDFOptimizer

~PDFOptimizer()

Member Function Documentation

get_major_version

int get_major_version()

Returns:

int

The major PDF version number, or 0 if the Optimizer will decide.

Get the value of the Major Version of the optimized document.

NOTE: A value of 0 indicates the Optimizer will decide what version it should be.

get_max_resolution

int get_max_resolution(OptimizerImageType type)

Parameters

type: OptimizerImageType

The image color type (Color, Gray, or BW) to query.

Returns:

int

The maximum resolution in DPI above which images will be downsampled.

Get the value of the Max DPI for a given color model.

get_minor_version

int get_minor_version()

Returns:

int

The minor PDF version number.

Get the value of the Minor Version of the optimized document.

get_option

bool get_option(OptimizerOption option)

Parameters

option: OptimizerOption

The optimization option to query.

Returns:

bool

true if the option is enabled, false if it is disabled.

Get the value of a single Optimizer Option.

get_resample_to_resolution

int get_resample_to_resolution(OptimizerImageType type)

Parameters

type: OptimizerImageType

The image color type (Color, Gray, or BW) to query.

Returns:

int

The target resolution in DPI to which images will be downsampled.

Get the value of the Resample To DPI for a given color model.

optimize

void optimize(Document & document, const std::string & output_path)

Parameters

document: Document &

The document to optimize.

output_path: const std::string &

The file system path where the optimized document will be saved.

Returns:

void

Optimize a document and save to a new file path. Perform the Optimization of a single document, saving the result in a new file.

set_compression_quality

void set_compression_quality(OptimizerImageType type, OptimizerCompressQuality value)

Parameters

type: OptimizerImageType

The image color type (Color, Gray, or BW) to set.

value: OptimizerCompressQuality

The compression quality level to apply.

Returns:

void

Set the value for the Compression Quality for a given color model. Any image that recompressed, regardless of the reason, will use this Quality for the Quality value of the specific compression type.

set_major_version

void set_major_version(int major)

Parameters

major: int

The major PDF version number.

Returns:

void

Set the value for the Major Version for the optimized document.

set_max_resolution

void set_max_resolution(OptimizerImageType type, int value)

Parameters

type: OptimizerImageType

The image color type (Color, Gray, or BW) to set.

value: int

The maximum resolution in DPI.

Returns:

void

Set the value for the Max DPI for a given color model. Any image above this resolution will be down sampled, if the Downsampling option is true for this color model.

set_minor_version

void set_minor_version(int minor)

Parameters

minor: int

The minor PDF version number.

Returns:

void

Set the value for the Minor Version for the optimized document.

set_option

void set_option(OptimizerOption option, bool value)

Parameters

option: OptimizerOption

The optimization option to set.

value: bool

true to enable the option, false to disable it.

Returns:

void

Set the value of a single Optimizer option.

set_recompression_type

void set_recompression_type(OptimizerImageType type, OptimizerCompressionType value)

Parameters

type: OptimizerImageType

The image color type (Color, Gray, or BW) to set.

value: OptimizerCompressionType

The compression type to apply.

Returns:

void

Set the value for the recompression Type for a given color model. Any image that is downsampled will be compressed using this method, if the Downsampling option is true for this color model. Any image that is not downsampled, will be converted to this compression type, if it is not already compressed in this type, and the Recompression option for this color model is true.

set_resample_to_resolution

void set_resample_to_resolution(OptimizerImageType type, int value)

Parameters

type: OptimizerImageType

The image color type (Color, Gray, or BW) to set.

value: int

The target resolution in DPI.

Returns:

void

Set the value for the Resample To DPI for a given color model. Any image will be downsampled to this resolution, if the Downsampling option is true for this color model.