OptimizationOptions

Inheritance: java.lang.Object

public class OptimizationOptions

Class which describes document optimization algorithm. Instance of this class may be used as parameter of OptimizeResources() method.

Constructors

ConstructorDescription
OptimizationOptions()

Methods

MethodDescription
isCompressObjects()If this flag is set to , Pdf objects will be packed into Objest Streams and compressed to reduce pdf file size.
setCompressObjects(boolean value)If this flag is set to , Pdf objects will be packed into Objest Streams and compressed to reduce pdf file size.
getLinkDuplcateStreams()If this flag is set to true, Resource streams will be analyzed.
setLinkDuplcateStreams(boolean value)If this flag is set to true, Resource streams will be analyzed.
getAllowReusePageContent()If true page contents will be reused when document is optimized for equal pages.
setAllowReusePageContent(boolean value)If true page contents will be reused when document is optimized for equal pages.
getRemoveUnusedStreams()If this flag set to true, every resource is checked on it’s usage.
setRemoveUnusedStreams(boolean value)If this flag set to true, every resource is checked on it’s usage.
getRemoveUnusedObjects()If this flag is set to true, all document objects will be checked and unused objects (i.e.
setRemoveUnusedObjects(boolean value)If this flag is set to true, all document objects will be checked and unused objects (i.e.
getImageCompressionOptions()Set of options which describe will images in the document be compressed and parameters of the compression.
setImageCompressionOptions(ImageCompressionOptions value)Set of options which describe will images in the document be compressed and parameters of the compression.
getCompressImages()If this flag is set to true images will be compressed in the document.
setCompressImages(boolean value)If this flag is set to true images will be compressed in the document.
getResizeImages()If this flag set to true and CompressImages is true images will be resized if image resoultion is greater then specified MaxResolution parameter.
setResizeImages(boolean value)If this flag set to true and CompressImages is true images will be resized if image resoultion is greater then specified MaxResolution parameter.
getImageQuality()Specifies level of image compression when CompressIamges flag is used.
setImageQuality(int value)Specifies level of image compression when CompressIamges flag is used.
getMaxResoultion()Specifies maximum resolution of images.
setMaxResoultion(int value)Specifies maximum resolution of images.
getUnembedFonts()Make fonts not embedded if set to true.
setUnembedFonts(boolean value)Make fonts not embedded if set to true.
getSubsetFonts()Fonts will be converted into subsets if set to true.
setSubsetFonts(boolean value)Fonts will be converted into subsets if set to true.
getRemovePrivateInfo()Remove private information (page piece info).
setRemovePrivateInfo(boolean value)Remove private information (page piece info).
getImageEncoding()Image encodre which will be used.
setImageEncoding(int value)Image encodre which will be used.
all()Creates optimization strategy will all options activated.

OptimizationOptions()

public OptimizationOptions()

isCompressObjects()

public final boolean isCompressObjects()

If this flag is set to , Pdf objects will be packed into Objest Streams and compressed to reduce pdf file size.

Returns: boolean - boolean value

setCompressObjects(boolean value)

public final void setCompressObjects(boolean value)

If this flag is set to , Pdf objects will be packed into Objest Streams and compressed to reduce pdf file size.

Parameters:

ParameterTypeDescription
valuebooleanboolean value

getLinkDuplcateStreams()

public final boolean getLinkDuplcateStreams()

If this flag is set to true, Resource streams will be analyzed. If duplicate streams are found (i.e. if stream contents is equal), then those streams will be stored as one object. This allows to decrease document size in some cases (for example, when same document was concatenated multiple times).

Returns: boolean - boolean value

setLinkDuplcateStreams(boolean value)

public final void setLinkDuplcateStreams(boolean value)

If this flag is set to true, Resource streams will be analyzed. If duplicate streams are found (i.e. if stream contents is equal), then those streams will be stored as one object. This allows to decrease document size in some cases (for example, when same document was concatenated multiple times).

Parameters:

ParameterTypeDescription
valuebooleanboolean value

getAllowReusePageContent()

public final boolean getAllowReusePageContent()

If true page contents will be reused when document is optimized for equal pages.

Returns: boolean - boolean value

setAllowReusePageContent(boolean value)

public final void setAllowReusePageContent(boolean value)

If true page contents will be reused when document is optimized for equal pages.

Parameters:

ParameterTypeDescription
valuebooleanboolean value

getRemoveUnusedStreams()

public final boolean getRemoveUnusedStreams()

If this flag set to true, every resource is checked on it’s usage. If resource is never used, then resources is removed. This may decrease document size for example when pages were extracted from document.

Returns: boolean - boolean value

setRemoveUnusedStreams(boolean value)

public final void setRemoveUnusedStreams(boolean value)

If this flag set to true, every resource is checked on it’s usage. If resource is never used, then resources is removed. This may decrease document size for example when pages were extracted from document.

Parameters:

ParameterTypeDescription
valuebooleanboolean value

getRemoveUnusedObjects()

public final boolean getRemoveUnusedObjects()

If this flag is set to true, all document objects will be checked and unused objects (i.e. objects which does not have any reference) are removed from document.

Returns: boolean - boolean value

setRemoveUnusedObjects(boolean value)

public final void setRemoveUnusedObjects(boolean value)

If this flag is set to true, all document objects will be checked and unused objects (i.e. objects which does not have any reference) are removed from document.

Parameters:

ParameterTypeDescription
valuebooleanboolean value

getImageCompressionOptions()

public final ImageCompressionOptions getImageCompressionOptions()

Set of options which describe will images in the document be compressed and parameters of the compression.

Returns: ImageCompressionOptions - ImageCompressionOptions instance

setImageCompressionOptions(ImageCompressionOptions value)

public final void setImageCompressionOptions(ImageCompressionOptions value)

Set of options which describe will images in the document be compressed and parameters of the compression.

Parameters:

ParameterTypeDescription
valueImageCompressionOptionsImageCompressionOptions instance

getCompressImages()

public final boolean getCompressImages()

If this flag is set to true images will be compressed in the document. compression level is specfied with ImageQuality property.

Returns: boolean - boolean value

setCompressImages(boolean value)

public final void setCompressImages(boolean value)

If this flag is set to true images will be compressed in the document. compression level is specfied with ImageQuality property.

Parameters:

ParameterTypeDescription
valuebooleanboolean value

getResizeImages()

public final boolean getResizeImages()

If this flag set to true and CompressImages is true images will be resized if image resoultion is greater then specified MaxResolution parameter.

Returns: boolean - boolean value

setResizeImages(boolean value)

public final void setResizeImages(boolean value)

If this flag set to true and CompressImages is true images will be resized if image resoultion is greater then specified MaxResolution parameter.

Parameters:

ParameterTypeDescription
valuebooleanboolean value

getImageQuality()

public final int getImageQuality()

Specifies level of image compression when CompressIamges flag is used.

Returns: int - int value

setImageQuality(int value)

public final void setImageQuality(int value)

Specifies level of image compression when CompressIamges flag is used.

Parameters:

ParameterTypeDescription
valueintint value

getMaxResoultion()

public final int getMaxResoultion()

Specifies maximum resolution of images. If image has higher resolition it will be scaled

Returns: int - int value

setMaxResoultion(int value)

public final void setMaxResoultion(int value)

Specifies maximum resolution of images. If image has higher resolition it will be scaled

Parameters:

ParameterTypeDescription
valueintint value

getUnembedFonts()

public final boolean getUnembedFonts()

Make fonts not embedded if set to true.

Returns: boolean - boolean value

setUnembedFonts(boolean value)

public final void setUnembedFonts(boolean value)

Make fonts not embedded if set to true.

Parameters:

ParameterTypeDescription
valuebooleanboolean value

getSubsetFonts()

public final boolean getSubsetFonts()

Fonts will be converted into subsets if set to true.

Returns: boolean - boolean value

setSubsetFonts(boolean value)

public final void setSubsetFonts(boolean value)

Fonts will be converted into subsets if set to true.

Parameters:

ParameterTypeDescription
valuebooleanboolean value

getRemovePrivateInfo()

public final boolean getRemovePrivateInfo()

Remove private information (page piece info).

Returns: boolean - boolean value

setRemovePrivateInfo(boolean value)

public final void setRemovePrivateInfo(boolean value)

Remove private information (page piece info).

Parameters:

ParameterTypeDescription
valuebooleanboolean value

getImageEncoding()

public final int getImageEncoding()

Image encodre which will be used.

Returns: int - ImageEncoding element

setImageEncoding(int value)

public final void setImageEncoding(int value)

Image encodre which will be used.

Parameters:

ParameterTypeDescription
valueintImageEncoding element

all()

public static OptimizationOptions all()

Creates optimization strategy will all options activated. Please note that activated only options which does not change any functionality of the document. I.e. image compressing and fonts unembedding will not enabled (and can be embedded manually).

Returns: OptimizationOptions - OptimizationOptions object.