Class: ImageSettings

PDFNet.Optimizer. ImageSettings


new ImageSettings()

An object that stores downsampling/recompression settings for color and grayscale images.

Members


<static> CompressionMode :number

Type:
  • number

<static> DownsampleMode :number

Type:
  • number

Methods


forceChanges(force)

Sets whether image changes that grow the PDF file should be kept. This is off by default.
Parameters:
Name Type Description
force boolean if true all image changes will be kept.
Returns:
this object, for call chaining
Type
PDFNet.Optimizer.ImageSettings

forceRecompression(force)

Sets whether recompression to the specified compression method, should be forced when the image is not downsampled. By default the compression method for these images will not be changed.
Parameters:
Name Type Description
force boolean if true the compression method for all
Returns:
this object, for call chaining
Type
PDFNet.Optimizer.ImageSettings

setCompressionMode(mode)

Sets the output compression mode for this type of image The default value is e_retain
Parameters:
Name Type Description
mode number the compression mode to set
PDFNet.Optimizer.ImageSettings.CompressionMode = {
 e_retain : 0,
 e_flate : 1,
 e_jpeg : 2,
 e_jpeg2000 : 3,
 e_none : 4
}
Returns:
this object, for call chaining
Type
PDFNet.Optimizer.ImageSettings

setDownsampleMode(mode)

Sets the downsample mode for this type of image The default value is e_default which will allow downsampling of images
Parameters:
Name Type Description
mode number the compression mode to set
PDFNet.Optimizer.ImageSettings.DownsampleMode = {
 e_off : 0,
	e_default : 1
}
Returns:
this object, for call chaining
Type
PDFNet.Optimizer.ImageSettings

setImageDPI(maximum, resampling)

Sets the maximum and resampling dpi for images. By default these are set to 225 and 150 respectively.
Parameters:
Name Type Description
maximum number the highest dpi of an image before it will be resampled
resampling number the image dpi to resample to if an image is encountered over the maximum dpi
Returns:
this object, for call chaining
Type
PDFNet.Optimizer.ImageSettings

setQuality(quality)

Sets the quality for lossy compression modes. from 1 to 10 where 10 is lossless (if possible) the default value is 5
Parameters:
Name Type Description
quality number the quality for lossy compression modes.
Returns:
this object, for call chaining
Type
PDFNet.Optimizer.ImageSettings