public class ImageQualityOptimizer extends AbstractOptimizationHandler
Constructor and Description |
---|
ImageQualityOptimizer()
Creates an empty image quality optimizer.
|
ImageQualityOptimizer(Map
Creates a new image quality optimizer with custom configuration of image processors.
|
Modifier and Type | Method and Description |
---|---|
Map |
getImageProcessors()
Gets a copy of current configuration of the image processor.
|
PdfImageXObjectPredicate |
getPredicate()
Gets current search predicate.
|
protected void |
optimizePdf(com.itextpdf.kernel.pdf.PdfDocument document, OptimizationSession session)
The method searches across all the document and for each found PdfImageXObject performs an optimization according to its type.
|
ImageQualityOptimizer |
setJBig2Processor(IImageProcessor processor)
Sets a processor for ImageType.JBIG2 images.
|
ImageQualityOptimizer |
setJpeg2000Processor(IImageProcessor processor)
Sets a processor for ImageType.JPEG2000 images.
|
ImageQualityOptimizer |
setJpegProcessor(IImageProcessor processor)
Sets a processor for ImageType.JPEG images.
|
ImageQualityOptimizer |
setPngProcessor(IImageProcessor processor)
Sets a processor for ImageType.PNG images.
|
ImageQualityOptimizer |
setPredicate(PdfImageXObjectPredicate predicate)
Sets a search predicate.
|
ImageQualityOptimizer |
setTiffProcessor(IImageProcessor processor)
Sets a processor for ImageType.TIFF images.
|
public ImageQualityOptimizer()
public ImageQualityOptimizer(MapIImageProcessor> processors)
PdfImageXObject.identifyImageType()
call.
processors
- is a map where image types are associated with processors for them
PdfImageXObject.identifyImageType()
public ImageQualityOptimizer setJpegProcessor(IImageProcessor processor)
ImageType.JPEG
images. Note that type of the image is identifying based on PdfImageXObject.identifyImageType()
call.
processor
- is an image processor to set
PdfImageXObject.identifyImageType()
public ImageQualityOptimizer setJpeg2000Processor(IImageProcessor processor)
ImageType.JPEG2000
images. Note that type of the image is identifying based on PdfImageXObject.identifyImageType()
call.
processor
- is an image processor to set
PdfImageXObject.identifyImageType()
public ImageQualityOptimizer setJBig2Processor(IImageProcessor processor)
ImageType.JBIG2
images. Note that type of the image is identifying based on PdfImageXObject.identifyImageType()
call.
processor
- is an image processor to set
PdfImageXObject.identifyImageType()
public ImageQualityOptimizer setTiffProcessor(IImageProcessor processor)
ImageType.TIFF
images. Note that type of the image is identifying based on PdfImageXObject.identifyImageType()
call.
processor
- is an image processor to set
PdfImageXObject.identifyImageType()
public ImageQualityOptimizer setPngProcessor(IImageProcessor processor)
ImageType.PNG
images. Note that type of the image is identifying based on PdfImageXObject.identifyImageType()
call.
processor
- is an image processor to set
PdfImageXObject.identifyImageType()
public ImageQualityOptimizer setPredicate(PdfImageXObjectPredicate predicate)
PdfImageXObjectPredicate
with overridden method PdfImageXObjectPredicate.customCondition(PdfObject)
to skip some types of images during optimization process.
predicate
- is a predicate to set
public PdfImageXObjectPredicate getPredicate()
public MapIImageProcessor> getImageProcessors()
ImageType
keys are associated with actual IImageProcessor
protected void optimizePdf(com.itextpdf.kernel.pdf.PdfDocument document, OptimizationSession session)
PdfImageXObject
performs an optimization according to its type.
optimizePdf
in class AbstractOptimizationHandler
document
- is the PDF document to optimize. Invocation of the method can change the state of the object
session
- is an auxiliary object used to support share data between stages of optimization process
Copyright © 1998–2020 iText Group NV. All rights reserved.