CIB pdf toolbox 2 technical documentation

4. Usecases

4.13. Compression of documents

Property

Meaning

Type

Compress

A flag indicating, that compression should be activated.

Set

CompressQuality

Defining a compression profile, which  sets a lot of other settings regarding compression. Available profile names are:

  • lossless: uses only lossless image encoding algorithm, highest file size
  • highest: already uses non lossless image algorithm, but at highest image quality
  • higher: higher image quality - higher file size
  • normal: normal image quality - normal file size
  • - low: low image quality - low file size

Set

Threads

The amount of threads, which are allowed to work on compression. The default is the available number of CPUs – 1. If you want to disable threading, you need to set this propert to 0 or 1.

Set

RemovePieceInfo

A flag which indicates removing propriertary data of pdf creators from the PDF document. This is default for all compression profies.

Set

RemoveThumbs

A flag which indicates removing page thumbnail images of the PDF document. This is default for all compression profies.

Set

OptimizePages

A flag which indicates to optimize the internal page tree of the PDF document. This is default for all compression profies.

Set

RemoveAlternateImages

A flag which indicates to remove alternate images. This is default for all compression profies.

Set

RemoveSpiderInfo

A flag which indicates to remove spider info. This is default for all compression profies.

Set

OptimizeContent

A flag which indicates to otimize the content streams of all pages and removing unneeded commands. This is default for all compression profies.

Set

OptimizeStreams

A flag which indicates to otimize the streams in general to check, if they can be saved by lossless reduction by resaving them with tuned saving parameters.

Set

Compress

Compression can take a lot time. You can set Property Cancel=1 to indicate, that the compression should be canceled and compression should be stopped. This is a thread-safe property and can be set from different threads.

Set

 

Instead Compress and CompressQuality also finetuning of the reencoding of the images can be done. Normally this finetuning is not recommended.

Property

Meaning

Type

ReEncodeImages

A flag indicating, that the document images should be reencoded.

Set

ReEncodeImagesOptions

A JSON object which configures the image reencoding with following keys:

  • MRCProfile: <profile> Same profiles as in CompressQuality, which define base rules for reencodeing.
  • TargetColorImages: Can be Jpeg2000, Jpeg, MRC or empty
  • TargetColorIndexedImages: Can be Jpeg2000, Jpeg, MRC or empty
  • TargetColorImages: Cab be Jpeg2000, Jpeg, MRC or empty
  • TargetMonochromeImages: Can be jbig2 or empty
  • MRCTargetDPI: <number>, sets the Target DPI under which the MRC decompistion is done. It should work best between 200 and 400 dpi.
  • JBig2Combine: <boolean>, flag, indicating, that all creared JBIG2 images should try to combine found symbols in a common global section. This normally reduces the size.
  • Jpeg2000Quality: <number> the quality value for created JPEG2000 images
  • JpegQuality: <number> the quality value for created Jpeg images
  • Jpeg2000QualityBackground: <number> jpeg2000 quality for MRC background images
  • Jpeg2000QualityForeground: <number> jpeg2000 quality for MRC foreground images
  • MRCIterativeJpeg2000: <boolean> actvates an iterative approach to get best sized jpeg2000 images
  • MRCWriteLayers: <boolean> writes Layer information, so that you can enable and disable in a Layer enabled viewer the MRC layers.
  • MRCMinHeight: <number> Sets a minimum height in pixel on which images MRC is tried
  • MRCMinWidth: <number> Sets a minimum width in pixel on which images MRC is tried
  • MRCMinDpi: <number> Sets a minimum dpi on which images MRC is tried
  • MRCRatioForeground: <number> the ratio the foreground is shrinked in its dimensions compared to the original image
  • MRCRatioBackground; <number> the ratio the backhround is shrinked in its dimensions compared to the original image

Set