public class OptSettings extends Object
PDFOptimizer
during optimization. By default, duplicate images
will be merged, duplicate fonts will be merged, uncompressed streams will be compressed, and
unused resources will be discarded.Modifier and Type | Field and Description |
---|---|
static int |
JPEG_RECOMPRESS_ALWAYS
Always recompress JPEG images.
|
static int |
JPEG_RECOMPRESS_NEVER
Never recompress JPEG images.
|
static int |
JPEG_RECOMPRESS_SMALLER
Recompress JPEG images if the resulting image will be smaller.
|
Constructor and Description |
---|
OptSettings() |
Modifier and Type | Method and Description |
---|---|
ImageHandler |
getImageHandler()
Returns the image handler currently registered with these settings.
|
int |
getJPEGRecompressLogic()
Deprecated.
This setting will no longer be applied. Instead use
ImageOutput.getOnlyChangeIfSmaller . |
boolean |
isClearSignatures()
Returns true if signatures should be cleared.
|
boolean |
isClearUsageRights()
Returns true if usage rights should be cleared.
|
boolean |
isCompressObjectsIntoStreams()
Returns true if objects will be compressed into object streams during optimization.
|
boolean |
isDiscardAltImages()
Returns true if alternate images will be discarded during optimization.
|
boolean |
isDiscardAnnotations()
Returns true if annotations will be discarded during optimization.
|
boolean |
isDiscardBookmarks()
Returns true if bookmarks will be discarded during optimization.
|
boolean |
isDiscardDocumentInfo()
Returns true if document info will be discarded during optimization.
|
boolean |
isDiscardFileAttachments()
Returns true if file attachments will be discarded during optimization.
|
boolean |
isDiscardFormFields()
Returns true if form fields will be discarded during optimization.
|
boolean |
isDiscardJSActions()
Returns true if JavaScript actions will be discarded during optimization.
|
boolean |
isDiscardLinks()
Returns true if links will be discarded during optimization.
|
boolean |
isDiscardPageThumbnails()
Returns true if page thumbnails will be discarded during optimization.
|
boolean |
isDiscardUnusedBookmarks()
Returns true if unused bookmarks will be discarded during optimization.
|
boolean |
isDiscardUnusedLinks()
Returns true if unused links will be discarded during optimization.
|
boolean |
isDiscardUnusedResources()
Returns true if unused resources will be discarded during optimization.
|
boolean |
isDiscardXMPData()
Returns true if XMP metadata will be discarded during optimization.
|
boolean |
isFlateUncompressedStreams()
Returns true if uncompressed streams will be compressed during optimization.
|
boolean |
isFlattenAnnotations()
Returns true if annotations will be flattened during optimization.
|
boolean |
isFlattenFormFields()
Returns true if form fields will be flattened during optimization.
|
boolean |
isFlattenLayers()
Returns true if layers will be flattened during optimization.
|
boolean |
isJPEGConvertCMYKToRGBOn17()
Returns the value of the "convert CMYK to RGB when compressing to JPEG and running in Java 7 or higher".
|
boolean |
isLinearize()
Returns true if the document will be linearized during optimization.
|
boolean |
isMergeDuplicateFonts()
Returns true if duplicate fonts will be merged during optimization.
|
boolean |
isMergeDuplicateImages()
Returns true if duplicate images will be merged during optimization.
|
void |
setClearSignatures(boolean clearSignatures)
Sets the flag to clear signatures during optimization.
|
void |
setClearUsageRights(boolean clearUsageRights)
Sets the flag to clear usage rights during optimization.
|
void |
setCompressObjectsIntoStreams(boolean compressObjectsIntoStreams)
Sets the flag to compress objects into object streams during optimization.
|
void |
setDiscardAltImages(boolean discardAltImages)
Sets the flag to discard alternate images during optimization.
|
void |
setDiscardAnnotations(boolean discardAnnotations)
Sets the flag to discard annotations during optimization.
|
void |
setDiscardBookmarks(boolean discardBookmarks)
Set to true to discard bookmarks during optimization.
|
void |
setDiscardDocumentInfo(boolean discardDocumentInfo)
Sets the flag to discard document info during optimization.
|
void |
setDiscardFileAttachments(boolean discardFileAttachments)
Sets the flag to discard file attachments during optimization.
|
void |
setDiscardFormFields(boolean discardFormFields)
Sets the flag to discard form fields during optimization.
|
void |
setDiscardJSActions(boolean discardJSActions)
Sets the flag to discard JavaScript actions during optimization.
|
void |
setDiscardLinks(boolean discardLinks)
Set the flag to discard links during optimization.
|
void |
setDiscardPageThumbnails(boolean discardPageThumbnails)
Sets the flag to discard page thumbnails during optimization.
|
void |
setDiscardUnusedBookmarks(boolean b)
Set to true to discard unused bookmarks during optimization.
|
void |
setDiscardUnusedLinks(boolean b)
Set to true to discard unused links during optimization.
|
void |
setDiscardUnusedResources(boolean discardUnusedResources)
Sets the flag to discard unused resources during optimization.
|
void |
setDiscardXMPData(boolean discardXMPData)
Sets the flag to discard XMP metadata during optimization.
|
void |
setFlateUncompressedStreams(boolean flateUncompressedStreams)
Sets the flag to compress uncompressed streams during optimization.
|
void |
setFlattenAnnotations(boolean flattenAnnotations)
Sets the flag to flatten annotations during optimization.
|
void |
setFlattenFormFields(boolean flattenFormFields)
Sets the flag to flatten form fields during optimization.
|
void |
setFlattenLayers(boolean flattenLayers)
Sets the flag to flatten layers during optimization.
|
void |
setImageHandler(ImageHandler ih)
Sets the image handler for these optimization settings.
|
void |
setJPEGConvertCMYKToRGBOn17(boolean convert)
Sets the flag to convert CMYK images to RGB when compressing to JPEG, when running in Java 7 or higher.
|
void |
setJPEGRecompressLogic(int recompress)
Deprecated.
This setting will no longer be applied. Instead use
ImageOutput.setOnlyChangeIfSmaller . |
void |
setLinearize(boolean linearize)
Sets the flag to linearize the document during optimization.
|
void |
setMergeDuplicateFonts(boolean mergeDuplicateFonts)
Sets the flag to merge duplicate fonts during optimization.
|
void |
setMergeDuplicateImages(boolean mergeDuplicateImages)
Sets the flag to merge duplicate images during optimization.
|
public static final int JPEG_RECOMPRESS_NEVER
public static final int JPEG_RECOMPRESS_ALWAYS
public static final int JPEG_RECOMPRESS_SMALLER
public boolean isMergeDuplicateImages()
public void setMergeDuplicateImages(boolean mergeDuplicateImages)
mergeDuplicateImages
- The new value of the merge duplicate images flag.public boolean isMergeDuplicateFonts()
public void setMergeDuplicateFonts(boolean mergeDuplicateFonts)
mergeDuplicateFonts
- The new value of the merge duplicate fonts flag.public boolean isClearSignatures()
public void setClearSignatures(boolean clearSignatures)
clearSignatures
- The new value of the clear signatures flag.public boolean isClearUsageRights()
public void setClearUsageRights(boolean clearUsageRights)
clearUsageRights
- The new value of the clear usage rights flag.public boolean isDiscardAltImages()
public void setDiscardAltImages(boolean discardAltImages)
discardAltImages
- The new value of the discard alternate images flag.public boolean isDiscardPageThumbnails()
public void setDiscardPageThumbnails(boolean discardPageThumbnails)
discardPageThumbnails
- The new value of the discard page thumbnails flag.public boolean isDiscardJSActions()
public void setDiscardJSActions(boolean discardJSActions)
discardJSActions
- The new value of the discard JavaScript actions flag.public boolean isDiscardXMPData()
public void setDiscardXMPData(boolean discardXMPData)
discardXMPData
- The new value of the discard XMP metadata flag.public boolean isDiscardDocumentInfo()
public void setDiscardDocumentInfo(boolean discardDocumentInfo)
discardDocumentInfo
- The new value of the discard document info flag.public boolean isDiscardBookmarks()
public void setDiscardBookmarks(boolean discardBookmarks)
discardBookmarks
- The new value of the discard bookmarks flag.public boolean isDiscardLinks()
public void setDiscardLinks(boolean discardLinks)
discardLinks
- The new value of the discard links flag.public boolean isDiscardAnnotations()
public void setDiscardAnnotations(boolean discardAnnotations)
discardAnnotations
- The new value of the discard annotations flag.public boolean isDiscardFormFields()
public void setDiscardFormFields(boolean discardFormFields)
discardFormFields
- The new value of the discard form fields flag.public boolean isDiscardUnusedResources()
public void setDiscardUnusedResources(boolean discardUnusedResources)
discardUnusedResources
- The new value of the discard unused resources flag.public boolean isDiscardFileAttachments()
public void setDiscardFileAttachments(boolean discardFileAttachments)
discardFileAttachments
- The new value of the discard file attachments flag.public boolean isFlattenAnnotations()
public void setFlattenAnnotations(boolean flattenAnnotations)
flattenAnnotations
- The new value of the flatten annotations flag.public boolean isFlattenFormFields()
public void setFlattenFormFields(boolean flattenFormFields)
flattenFormFields
- The new value of the flatten form fields flag.public boolean isFlattenLayers()
public void setFlattenLayers(boolean flattenLayers)
flattenLayers
- The new value of the flatten layers flag.public boolean isFlateUncompressedStreams()
public void setFlateUncompressedStreams(boolean flateUncompressedStreams)
flateUncompressedStreams
- The new value of the flate uncompressed streams flag.public boolean isCompressObjectsIntoStreams()
public void setCompressObjectsIntoStreams(boolean compressObjectsIntoStreams)
compressObjectsIntoStreams
- The new value of the compress objects into streams flag.public void setLinearize(boolean linearize)
linearize
- The new value of the linearize flag.public boolean isLinearize()
public ImageHandler getImageHandler()
public void setImageHandler(ImageHandler ih)
ih
- The new image handler implementation.public void setJPEGConvertCMYKToRGBOn17(boolean convert)
convert
- The new value of the flag.public boolean isJPEGConvertCMYKToRGBOn17()
setJPEGConvertCMYKToRGBOn17(boolean)
method for more details.public void setJPEGRecompressLogic(int recompress)
ImageOutput.setOnlyChangeIfSmaller
.recompress
- The JPEG recompression logic. One of OptSettings.JPEG_RECOMPRESS_NEVER, OptSettings.JPEG_RECOMPRESS_ALWAYS, OptSettings.JPEG_RECOMPRESS_SMALLER.public int getJPEGRecompressLogic()
ImageOutput.getOnlyChangeIfSmaller
.public boolean isDiscardUnusedLinks()
public void setDiscardUnusedLinks(boolean b)
b
- The new value of the flag.public boolean isDiscardUnusedBookmarks()
public void setDiscardUnusedBookmarks(boolean b)
b
- The new value of the flag.