Foxit PDF SDK

Static Public Member Functions | List of all members
foxit.addon.optimization.Optimizer Class Reference
Inheritance diagram for foxit.addon.optimization.Optimizer:

## Static Public Member Functions
static AuditSpaceSize | ComputeAuditSpace (PDFDoc doc)
| Compute audit space. More...
static Progressive | Optimize (PDFDoc doc, OptimizerSettings settings, PauseCallback pause)
| Optimize the given PDF document with specified optimizer settings. More...
static Progressive | OptimizeScannedPDF (PDFDoc doc, OptimizeScannedPDFSettings settings, ImageCompressionCallback image_compress_callback, PauseCallback pause)
| Optimize the scanned PDF document with specified optimizers settings. More...
static Progressive | StartSubsetEmbedFont (PDFDoc doc, PauseCallback pause)
| Start to make subsets for embedded fonts in the given PDF document. More...

## Detailed Description

This class can be used to optimize PDF file to reduce file size. Before using this class to do optimization, please ensure Foxit PDF SDK has been initialized successfully by function common.Library.Initialize with a key including "Optimizer" module.

See also
  foxit.common.Library

## Member Function Documentation

## ◆ ComputeAuditSpace()

static AuditSpaceSize foxit.addon.optimization.Optimizer.ComputeAuditSpace | ( | PDFDoc | doc | ) |
| inline static

Compute audit space.

Parameters

  [in] | doc | A valid PDF document object to audit space.

Returns
  A struct that contain all audit space contents.

## ◆ Optimize()

static Progressive foxit.addon.optimization.Optimizer.Optimize | ( | PDFDoc | doc,
|  | OptimizerSettings | settings,
|  | PauseCallback | pause
| ) |  |
| inline static

Optimize the given PDF document with specified optimizer settings.

Parameters

  [in] | doc | A valid PDF document object to be optimized.
  [in] | settings | Setting data used for optimization processing settings.
  [in] | pause | Pause object which decides if the process needs to be paused. This can be null which means not to pause during the optimization process. If this is not null, it should be a valid pause object implemented by user.

Note
  If module "Optimizer" is not defined in the license information which is used in function common.Library.Initialize , that means user has no right in using Optimization related functions and this function will throw exception foxit.common.ErrorCode.e_ErrNoOptimizerModuleRight .

Returns
  A progressive object. Please check the rate of current progress by function common.Progressive.GetRateOfProgress . If the rate is not 100 yet, call function common.Progressive.Continue to continue the progress until the progress is finished.

## ◆ OptimizeScannedPDF()

static Progressive foxit.addon.optimization.Optimizer.OptimizeScannedPDF | ( | PDFDoc | doc,
|  | OptimizeScannedPDFSettings | settings,
|  | ImageCompressionCallback | image_compress_callback,
|  | PauseCallback | pause
| ) |  |
| inline static

Optimize the scanned PDF document with specified optimizers settings.

Parameters

  [in] | doc | A valid PDF document object to be optimized.
  [in] | settings | Setting data used for optimization processing settings.
  [in] | image_compress_callback | A foxit.addon.optimization.ImageCompressionCallback object which is implemented by user for temp file data during replacing page process. When replacing pages process is finished (no matter successfully or not), callback function foxit.addon.optimization.ImageCompressionCallback.Release will be called by Foxit PDF SDK.
  [in] | pause | Pause object which decides if the process needs to be paused. This can be null which means not to pause during the optimization process. If this is not null, it should be a valid pause object implemented by user.

Note
  If module "Optimizer" is not defined in the license information which is used in function common.Library.Initialize , that means user has no right in using Optimization related functions and this function will throw exception foxit.common.ErrorCode.e_ErrNoOptimizerModuleRight . If optimize the scanned pdf finished, the specify pages to be optimized needs to be reloaded.

Returns
  A progressive object. Please check the rate of current progress by function common.Progressive.GetRateOfProgress . If the rate is not 100 yet, call function common.Progressive.Continue to coninue the progress until the progress is finished.

## ◆ StartSubsetEmbedFont()

static Progressive foxit.addon.optimization.Optimizer.StartSubsetEmbedFont | ( | PDFDoc | doc,
|  | PauseCallback | pause
| ) |  |
| inline static

Start to make subsets for embedded fonts in the given PDF document.

This function can be used to remove useless embedded characters from the data of embedded fonts (if there's any in a PDF document) in order to reduce the size of a PDF document.

Parameters

  [in] | doc | A valid PDF document object to be processed a subset of embedded fonts.
  [in] | pause | Pause object which decides if the process needs to be paused. This can be null which means not to pause during the embeded font subset process. If this is not null, it should be a valid pause object implemented by user.

Note
  If module "Optimizer" is not defined in the license information which is used in function common.Library.Initialize , that means user has no right in using Optimization related functions and this function will throw exception foxit.common.ErrorCode.e_ErrNoOptimizerModuleRight .

Returns
  A progressive object. Please check the rate of current progress by function common.Progressive.GetRateOfProgress . If the rate is not 100 yet, call function common.Progressive.Continue to continue the progress until the progress is finished.