Foxit PDF SDK

Class Methods | List of all members
FSOptimizer Class Reference
Inheritance diagram for FSOptimizer:

## Class Methods
(FSAuditSpaceSize *) | + computeAuditSpace:
| Compute audit space. More...
(FSProgressive *) | + optimize:settings:pause:
| Optimize the given PDF document with specified optimizer settings. More...
(FSProgressive *) | + optimizeScannedPDF:settings:image_compress_callback:pause:
| Optimize the scanned PDF document with specified optimizers settings. More...
(FSProgressive *) | + startSubsetEmbedFont: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 FSLibrary::initialize:key: with a key including "Optimizer" module.

See also
  FSLibrary

## Method Documentation

## ◆ computeAuditSpace:()

+ (FSAuditSpaceSize *) computeAuditSpace: |  | (FSPDFDoc*) | doc |

Compute audit space.

Parameters

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

Returns
  A struct that contain all audit space contents.

## ◆ optimize:settings:pause:()

+ (FSProgressive *) optimize: |  | (FSPDFDoc*) | doc
settings: |  | (FSOptimizerSettings*) | settings
pause: |  | (id<FSPauseCallback>) | pause

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 nil which means not to pause during the optimization process. If this is not nil, 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 FSLibrary::initialize:key:, that means user has no right in using Optimization related functions and this function will throw exception FSErrNoOptimizerModuleRight.

Returns
  A progressive object. Please check the rate of current progress by function FSProgressive::getRateOfProgress. If the rate is not 100 yet, call function FSProgressive::resume to continue the progress until the progress is finished.

## ◆ optimizeScannedPDF:settings:image_compress_callback:pause:()

+ (FSProgressive *) optimizeScannedPDF: |  | (FSPDFDoc*) | doc
settings: |  | (FSOptimizeScannedPDFSettings*) | settings
image_compress_callback: |  | (id<FSImageCompressionCallback>) | image_compress_callback
pause: |  | (id<FSPauseCallback>) | pause

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 FSImageCompressionCallback object which is implemented by user for temp file data during replacing page process.
  [in] | pause | Pause object which decides if the process needs to be paused. This can be nil which means not to pause during the optimization process. If this is not nil, 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 FSLibrary::initialize:key:, that means user has no right in using Optimization related functions and this function will throw exception FSErrNoOptimizerModuleRight. 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 FSProgressive::getRateOfProgress. If the rate is not 100 yet, call function FSProgressive::resume to coninue the progress until the progress is finished.

## ◆ startSubsetEmbedFont:pause:()

+ (FSProgressive *) startSubsetEmbedFont: |  | (FSPDFDoc*) | doc
pause: |  | (id<FSPauseCallback>) | pause

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 nil which means not to pause during the embeded font subset process. If this is not nil, 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 FSLibrary::initialize:key:, that means user has no right in using Optimization related functions and this function will throw exception FSErrNoOptimizerModuleRight.

Returns
  A progressive object. Please check the rate of current progress by function FSProgressive::getRateOfProgress. If the rate is not 100 yet, call function FSProgressive::resume to continue the progress until the progress is finished.