Foxit PDF SDK

Public Types | Public Member Functions | List of all members
foxit::addon::optimization::OptimizerSettings Class Reference
Inheritance diagram for foxit::addon::optimization::OptimizerSettings:

## Public Types
enum | CleanUpOptions { e_CleanUpUseFlateForNonEncodedStream = 0x01, e_CleanUpUseFlateInsteadOfLZW = 0x02, e_CleanUpRemoveInvalidBookmarks = 0x04, e_CleanUpRemoveInvalidLinks = 0x08, e_CleanUpDiscardUnreferencedNamedDes = 0x10, e_CleanUpOptPageContent = 0x20 }
| Enumeration for cleaning up options. More...
enum | DiscardObjectsOptions { e_DiscardObjectsFormActions = 0x01, e_DiscardObjectsFlattenFormFields = 0x02, e_DiscardObjectsJavaScriptActions = 0x04, e_DiscardObjectsEmbeddedPageThumbnails = 0x08, e_DiscardObjectsEmbeddedPrintSettings = 0x10, e_DiscardObjectsBookmarks = 0x20, e_DiscardObjectsAlternateImages = 0x40, e_DiscardObjectsDocumentTags = 0x80, e_DiscardObjectsEmbeddedSearchIndex = 0x100, e_DiscardObjectsDetectAndMergeImageFragment = 0x200, e_DiscardObjectsSmoothlinestocurves = 0x400 }
| Enumeration for discarding objects options. More...
enum | DiscardUserDataOptions { e_DiscardUserDataAllAnnotsFormsAndMultimedia = 0x01, e_DiscardUserDataExternalCrossReferences = 0x02, e_DiscardUserDataDocumentInfoAndMetaData = 0x04, e_DiscardUserDataFileAttchments = 0x08, e_DiscardUserDataPrivateDataOfOtherApp = 0x10, e_DiscardUserDataLayer = 0x20, e_DiscardUserAllData = 0x40 }
| Enumeration for discarding user data options. More...
enum | OptimizerOptions { e_OptimizerCompressImages = 0x01, e_OptimizerCleanUp = 0x02, e_OptimizerDiscardObjects = 0x04, e_OptimizerUnembeddedFonts = 0x08, e_OptimizerDiscardUserData = 0x10, e_OptimizerTransparency = 0x20 }
| Enumeration for optimizer options. More...
enum | TransparencyMode { e_TransparencyModeLowResolution = 0, e_TransparencyModeMediumResolution = 1, e_TransparencyModeHighResolution = 2 }
| Enumeration for transparency mode. More...

## Public Member Functions
| OptimizerSettings ()
| Constructor. More...
| OptimizerSettings (const OptimizerSettings &other)
| Constructor, with another optimizer settings object. More...
| ~OptimizerSettings ()
| Destructor.
bool | IsEmpty () const
| Check whether current object is empty or not. More...
bool | operator!= (const OptimizerSettings &other) const
| Not equal operator. More...
OptimizerSettings & | operator= (const OptimizerSettings &other)
| Assign operator. More...
bool | operator== (const OptimizerSettings &other) const
| Equal operator. More...
void | SetCleanUpOptions (foxit::uint32 clean_up_options)
| Set optimization related options for cleaning up. More...
void | SetColorGrayImageSettings (const ImageSettings &settings)
| Set optimization related settings for color/gray image. More...
void | SetColorImageSettings (const ImageSettings &settings)
| Set optimization related settings for color image. More...
void | SetDiscardObjectsOptions (foxit::uint32 discard_objects_options)
| Set optimization related options for discarding objects. More...
void | SetDiscardUserDataOptions (foxit::uint32 discard_userdata_options)
| Set optimization related options for discarding user data. More...
void | SetGrayscaleImageSettings (const ImageSettings &settings)
| Set optimization related settings for grayscale image. More...
void | SetMonoImageSettings (const MonoImageSettings &settings)
| Set optimization related settings for monochrome image. More...
void | SetOptimizerOptions (uint32 optimize_options)
| Set options to decide which kind of optimizer setting will be used for optimizing PDF document. More...
void | SetTransparencyMode (TransparencyMode transparency_mode)
| Set optimization related options for doing transparency. More...
void | SetUnembeddedFontSettings (const UnembeddedFontSettings &settings)
| Set optimization related settings for unembedding fonts. More...
Public Member Functions inherited from foxit::Base
FS_HANDLE | Handle () const
| Get the handle of current object. More...

## Detailed Description

This class represents settings for optimizing a PDF document. It would be used in class Optimizer.

See also
  Optimizer

## Member Enumeration Documentation

## ◆ CleanUpOptions

enum foxit::addon::optimization::OptimizerSettings::CleanUpOptions

Enumeration for cleaning up options.

Values of this enumeration can be used alone or in a combination.

Enumerator
e_CleanUpUseFlateForNonEncodedStream | Use Flate to encode streams that are not encoded.
e_CleanUpUseFlateInsteadOfLZW | In streams that use LZW encoding, use Flate instead.
e_CleanUpRemoveInvalidBookmarks | Remove invalid bookmarks.
e_CleanUpRemoveInvalidLinks | Remove invalid links.
e_CleanUpDiscardUnreferencedNamedDes | Discard unreferenced named destination.
e_CleanUpOptPageContent | Cleanup page content Change 0A,0D in the content stream to Spaces.

## ◆ DiscardObjectsOptions

enum foxit::addon::optimization::OptimizerSettings::DiscardObjectsOptions

Enumeration for discarding objects options.

Values of this enumeration can be used alone or in a combination.

Enumerator
e_DiscardObjectsFormActions | Discard all form submission, import and reset actions.
e_DiscardObjectsFlattenFormFields | Flatten form fields.
e_DiscardObjectsJavaScriptActions | Discard all JavaScript actions. Currently, it can not remove the javascript action in "OpenAction" of catalog.
e_DiscardObjectsEmbeddedPageThumbnails | Discard embedded page thumbnails.
e_DiscardObjectsEmbeddedPrintSettings | Discard embedded print settings.
e_DiscardObjectsBookmarks | Discard bookmarks.
e_DiscardObjectsAlternateImages | Discard all alternate images. Some PDF documents include multiple versions of the same image for different purposes, such as low-resolution on-screen viewing and high-resolution printing. If this option value is set to be used, that means to remove all versions of an image except the one destined for on-screen viewing.
e_DiscardObjectsDocumentTags | Discard document tags.
e_DiscardObjectsEmbeddedSearchIndex | Discard embedded search index.
e_DiscardObjectsDetectAndMergeImageFragment | Detect and merge image fragments.
e_DiscardObjectsSmoothlinestocurves | smooth lines to curves

## ◆ DiscardUserDataOptions

enum foxit::addon::optimization::OptimizerSettings::DiscardUserDataOptions

Enumeration for discarding user data options.

Values of this enumeration can be used alone or in a combination.

Enumerator
e_DiscardUserDataAllAnnotsFormsAndMultimedia | Discard all annotations, forms and multimedia.
e_DiscardUserDataExternalCrossReferences | Discard external cross references.
e_DiscardUserDataDocumentInfoAndMetaData | Discard document information and metadata.
e_DiscardUserDataFileAttchments | Discard file attachments.
e_DiscardUserDataPrivateDataOfOtherApp | Discard private data of other applications.
e_DiscardUserDataLayer | Discard hidden layer content and flatten visible layers.
e_DiscardUserAllData | discard tag user data

## ◆ OptimizerOptions

enum foxit::addon::optimization::OptimizerSettings::OptimizerOptions

Enumeration for optimizer options.

Values of this enumeration can be used alone or in a combination.

Enumerator
e_OptimizerCompressImages | Optimize PDF document by compressing images.
e_OptimizerCleanUp | Optimize PDF document by cleaning up.
e_OptimizerDiscardObjects | Optimize PDF document by discarding objects.
e_OptimizerUnembeddedFonts | Optimize PDF document by unembedding some embedded fonts.
e_OptimizerDiscardUserData | Optimize PDF document by discarding user data.
e_OptimizerTransparency | Optimize PDF document by doing transparency.

## ◆ TransparencyMode

enum foxit::addon::optimization::OptimizerSettings::TransparencyMode

Enumeration for transparency mode.

Values of this enumeration should be used alone.

Enumerator
e_TransparencyModeLowResolution | Transparency mode: low resolution. Low resolution includes: Transparency level: 75; Line Art and Text: 288; Gradient and Meshes: 144; Convert All Text to Outlines: False; Convert All Strokes to Outlines: True; Clip Complex Regions: False; Preserve Overprint Settings: True.
e_TransparencyModeMediumResolution | Transparency mode: medium resolution. Medium resolution includes: Transparency level: 75; Line Art and Text: 300; Gradient and Meshes: 150; Convert All Text to Outlines: False; Convert All Strokes to Outlines: True; Clip Complex Regions: True; Preserve Overprint Settings: True.
e_TransparencyModeHighResolution | Transparency mode: high resolution. High resolution includes: Transparency level: 100; Line Art and Text: 1200; Gradient and Meshes: 300; Convert All Text to Outlines: False; Convert All Strokes to Outlines: False; Clip Complex Regions: True; Preserve Overprint Settings: True.

## Constructor & Destructor Documentation

## ◆ OptimizerSettings() [1/2]

foxit::addon::optimization::OptimizerSettings::OptimizerSettings | ( |  | ) |

Constructor.

This constructor is to construct a optimizer settings object with default setting options. User can also call "set" methods in this class to change setting options. Please refer to comment in other settings class (which can be set to current object) for more details about what default setting options are.

## ◆ OptimizerSettings() [2/2]

foxit::addon::optimization::OptimizerSettings::OptimizerSettings | ( | const OptimizerSettings & | other | ) |

Constructor, with another optimizer settings object.

Parameters

  [in] | other | Another optimizer settings object.

## Member Function Documentation

## ◆ IsEmpty()

bool foxit::addon::optimization::OptimizerSettings::IsEmpty | ( |  | ) | const

Check whether current object is empty or not.

When the current object is empty, that means current object is useless.

Returns
  true means current object is empty, while false means not.

## ◆ operator!=()

bool foxit::addon::optimization::OptimizerSettings::operator!= | ( | const OptimizerSettings & | other | ) | const

Not equal operator.

Parameters

  [in] | other | Another optimizer settings object. This function will check if current object is not equal to this one.

Returns
  true means not equal, while false means equal.

## ◆ operator=()

OptimizerSettings& foxit::addon::optimization::OptimizerSettings::operator= | ( | const OptimizerSettings & | other | ) |

Assign operator.

Parameters

  [in] | other | Another optimizer settings object, whose value would be assigned to current object.

Returns
  Reference to current object itself.

## ◆ operator==()

bool foxit::addon::optimization::OptimizerSettings::operator== | ( | const OptimizerSettings & | other | ) | const

Equal operator.

Parameters

  [in] | other | Another optimizer settings object. This function will check if current object is equal to this one.

Returns
  true means equal, while false means not equal.

## ◆ SetCleanUpOptions()

void foxit::addon::optimization::OptimizerSettings::SetCleanUpOptions | ( | foxit::uint32 | clean_up_options | ) |

Set optimization related options for cleaning up.

For a newly constructed object, if this function is not called to set any clean-up options, that means not to do clean-up optimization. Clean-up options set by this function are useful only when option value OptimizerSettings::e_OptimizerCleanUp is set by function OptimizerSettings::SetOptimizerOptions.

Parameters

  [in] | clean_up_options | Optimization related options for cleaning up. 0 means not to do clean-up optimization. Please refer to values starting from OptimizerSettings::e_CleanUpUseFlateForNonEncodedStream and this can be one or a combination of these values.

Returns
  None.

## ◆ SetColorGrayImageSettings()

void foxit::addon::optimization::OptimizerSettings::SetColorGrayImageSettings | ( | const ImageSettings & | settings | ) |

Set optimization related settings for color/gray image.

Deprecated:
  Current function has been deprecated since Foxit PDF SDK 10.0. This function will not have any effect on OptimizerSettings any more. For setting color image, please call function OptimizerSettings::SetColorImageSettings. Please refer to SetColorImageSettings related function in OptimizerSettings for more details. For setting grayscale image, please call function OptimizerSettings::SetGrayscaleImageSettings. Please refer to SetGrayscaleImageSettings related function in OptimizerSettings for more details.

For a newly constructed object, if this function is not called to set any color/gray image settings, that means to use default color/gray image settings. Please refer to comment in class ImageSettings for default values.
ImageSettings set by this function is useful only when option value OptimizerSettings::e_OptimizerCompressImages is set by function OptimizerSettings::SetOptimizerOptions.

Parameters

  [in] | settings | Optimization related settings for color and grayscale images.

Returns
  None.

## ◆ SetColorImageSettings()

void foxit::addon::optimization::OptimizerSettings::SetColorImageSettings | ( | const ImageSettings & | settings | ) |

Set optimization related settings for color image.

For a newly constructed object, if this function is not called to set any color image settings, that means to use default color image settings. Please refer to comment in class ImageSettings for default values.
ImageSettings set by this function is useful only when option value OptimizerSettings::e_OptimizerCompressImages is set by function OptimizerSettings::SetOptimizerOptions.

Parameters

  [in] | settings | Optimization related settings for color images.

Returns
  None.

## ◆ SetDiscardObjectsOptions()

void foxit::addon::optimization::OptimizerSettings::SetDiscardObjectsOptions | ( | foxit::uint32 | discard_objects_options | ) |

Set optimization related options for discarding objects.

For a newly constructed object, if this function is not called to set any discard-objects options, that means not to do discard-objects optimization. Discard-objects options set by this function are useful only when option value OptimizerSettings::e_OptimizerDiscardObjects is set by function OptimizerSettings::SetOptimizerOptions.

Parameters

  [in] | discard_objects_options | Optimization related options for discarding objects. 0 means not to do discarding-objects optimization. Please refer to values starting from OptimizerSettings::e_DiscardObjectsFormActions and this can be one or a combination of these values.

Returns
  None.

## ◆ SetDiscardUserDataOptions()

void foxit::addon::optimization::OptimizerSettings::SetDiscardUserDataOptions | ( | foxit::uint32 | discard_userdata_options | ) |

Set optimization related options for discarding user data.

For a newly constructed object, if this function is not called to set any discard-userdata options, that means not to do discard-userdata optimization. Discard-userdata options set by this function are useful only when option value OptimizerSettings::e_OptimizerDiscardUserData is set by function OptimizerSettings::SetOptimizerOptions.

Parameters

  [in] | discard_userdata_options | Optimization related options for discarding user data. 0 means not to do discarding-userdata optimization. Please refer to values starting from OptimizerSettings::e_DiscardUserDataAllAnnotsFormsAndMultimedia and this can be one or a combination of these values.

Returns
  None.

## ◆ SetGrayscaleImageSettings()

void foxit::addon::optimization::OptimizerSettings::SetGrayscaleImageSettings | ( | const ImageSettings & | settings | ) |

Set optimization related settings for grayscale image.

For a newly constructed object, if this function is not called to set any grayscale image settings, that means to use default grayscale image settings. Please refer to comment in class ImageSettings for default values.
ImageSettings set by this function is useful only when option value OptimizerSettings::e_OptimizerCompressImages is set by function OptimizerSettings::SetOptimizerOptions.

Parameters

  [in] | settings | Optimization related settings for grayscale images.

Returns
  None.

## ◆ SetMonoImageSettings()

void foxit::addon::optimization::OptimizerSettings::SetMonoImageSettings | ( | const MonoImageSettings & | settings | ) |

Set optimization related settings for monochrome image.

For a newly constructed object, if this function is not called to set any monochrome image settings, that means to use default monochrome image settings. Please refer to comment in class MonoImageSettings for detail values.
MonoImageSettings set by this function is useful only when option value OptimizerSettings::e_OptimizerCompressImages is set by function OptimizerSettings::SetOptimizerOptions.

Parameters

  [in] | settings | Optimization related settings for monochrome images.

Returns
  None.

## ◆ SetOptimizerOptions()

void foxit::addon::optimization::OptimizerSettings::SetOptimizerOptions | ( | uint32 | optimize_options | ) |

Set options to decide which kind of optimizer setting will be used for optimizing PDF document.

For a newly constructed object, if this function is not called to set any optimizer options, that means no optimizer setting is useful.

Parameters

  [in] | optimize_options | The options to decide which kind of optimizer setting will be used for optimizing PDF document. 0 means no optimizer setting of any kind is useful. Please refer to values starting from OptimizerSettings::e_OptimizerCompressImages and this can be one or a combination of these values.

Returns
  None.

## ◆ SetTransparencyMode()

void foxit::addon::optimization::OptimizerSettings::SetTransparencyMode | ( | TransparencyMode | transparency_mode | ) |

Set optimization related options for doing transparency.

For a newly constructed object, if this function is not called to set any transparency mode, that means the transparency mode is OptimizerSettings::e_TransparencyModeLowResolution default.

Parameters

  [in] | transparency_mode | Optimization related options for transparency mode. Please refer to values starting from OptimizerSettings::e_TransparencyModeLowResolution and this must be one of these values. Default value is OptimizerSettings::e_TransparencyModeLowResolution.

Returns
  None.

## ◆ SetUnembeddedFontSettings()

void foxit::addon::optimization::OptimizerSettings::SetUnembeddedFontSettings | ( | const UnembeddedFontSettings & | settings | ) |

Set optimization related settings for unembedding fonts.

For a newly constructed object, if this function is not called to set any unembedded fonts settings, that means to no font is to be unembedded. UnembeddedFontSettings set by this function is useful only when option value OptimizerSettings::e_OptimizerUnembeddedFonts is set by function OptimizerSettings::SetOptimizerOptions.

Parameters

  [in] | settings | Optimization related settings for unembedding fonts.

Returns
  None.