Foxit PDF SDK

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

## Public Member Functions
synchronized void | delete ()
| Clean up related C++ resources immediately. More...

## Static Public Member Functions
static AuditSpaceSize | computeAuditSpace (PDFDoc doc) throws com.foxit.sdk.PDFException
| Compute audit space. More...
static Progressive | optimize (PDFDoc doc, OptimizerSettings settings, PauseCallback pause) throws com.foxit.sdk.PDFException
| Optimize the given PDF document with specified optimizer settings. More...
static Progressive | optimizeScannedPDF (PDFDoc doc, OptimizeScannedPDFSettings settings, ImageCompressionCallback image_compress_callback, PauseCallback pause) throws com.foxit.sdk.PDFException
| Optimize the scanned PDF document with specified optimizers settings. More...
static Progressive | startSubsetEmbedFont (PDFDoc doc, PauseCallback pause) throws com.foxit.sdk.PDFException
| 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
  com.foxit.sdk.common.Library

## Member Function Documentation

## ◆ computeAuditSpace()

static AuditSpaceSize com.foxit.sdk.addon.optimization.Optimizer.computeAuditSpace | ( | PDFDoc | doc | ) | throws com.foxit.sdk.PDFException
| static

Compute audit space.

Parameters

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

Returns
  A struct that contain all audit space contents.

## ◆ delete()

synchronized void com.foxit.sdk.addon.optimization.Optimizer.delete | ( |  | ) |

Clean up related C++ resources immediately.

Returns
  None.

Note
  Once this function is called, current object cannot be used anymore.

Reimplemented from com.foxit.sdk.common.Base.

## ◆ optimize()

static Progressive com.foxit.sdk.addon.optimization.Optimizer.optimize | ( | PDFDoc | doc,
|  | OptimizerSettings | settings,
|  | PauseCallback | pause
| ) |  | throws com.foxit.sdk.PDFException
| 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 com.foxit.sdk.common.Constants.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.resume to continue the progress until the progress is finished.

## ◆ optimizeScannedPDF()

static Progressive com.foxit.sdk.addon.optimization.Optimizer.optimizeScannedPDF | ( | PDFDoc | doc,
|  | OptimizeScannedPDFSettings | settings,
|  | ImageCompressionCallback | image_compress_callback,
|  | PauseCallback | pause
| ) |  | throws com.foxit.sdk.PDFException
| 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 com.foxit.sdk.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 com.foxit.sdk.common.Constants.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.resume to coninue the progress until the progress is finished.

## ◆ startSubsetEmbedFont()

static Progressive com.foxit.sdk.addon.optimization.Optimizer.startSubsetEmbedFont | ( | PDFDoc | doc,
|  | PauseCallback | pause
| ) |  | throws com.foxit.sdk.PDFException
| 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 com.foxit.sdk.common.Constants.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.resume to continue the progress until the progress is finished.