Skip to main content
Skip table of contents

PDF Compression (Version 1.0.0): Functions and Operations

PDF Compression: This adapter compresses PDF documents that exceed a certain size. Documents with a size below 100 KB are compressed only slightly, here the file size can hardly be reduced with the adapter.

Note:

For error-free compression of the PDF document, at least one of the following parameters must be set in the PDF Compression Adapter:

  • regularCompression
  • maximumCompression
  • xRefCompression
  • mergeResources
  • quantize with the numColors and alphaThreshold parameters 

Properties

Operation

Defines the operation executed by the function adapter

Possible values:

  • Compress: Compresses a PDF document

Parameters

Adapter

Main adapter class (do not change!)

Possible values: 

de.softproject.x4.adapter.PDFCompression: Main class (Default)

documentPassword

(optional)

Password for encrypting the PDF document

Possible values:

Character string in password format

regularCompression

The PDF is reduced in size using regular compression.

Note:

If only this parameter is set, low compression is to be expected.

Possible values:

  • true: The PDF is reduced in size using regular compression.
  • false: The PDF is not reduced in size using regular compression.
maximumCompression

The PDF is compressed with the maximum value. Best results are achieved in combination with the parameter regularCompression.

Note:

Activating this parameter can increase the runtime. For maximumCompression, ZLIB Compression Level 9 is used, which offers the best possible reduction in file size, but has the slowest compression.

Possible values:

  • true: The PDF is compressed with the maximum value.
  • false: The PDF is not compressed with the maximum value.
xRefCompression

The PDF is saved in a compressed xRef table (Cross Reference table). This option is only valid for PDFs from version 1.6 or higher and is not compatible with PDF/A-1 files.


Note:

Activating this parameter can increase the runtime. With this parameter, the file size can be reduced by 5 to 5 % if the PDF that is to be compressed has not been compressed previously with xRef Compression.


Possible values:

  • true: The PDF is saved in a compressed xRef table.
  • false: The PDF is not saved in a compressed xRef table. 
mergeResources

Merges duplicate resources (fonts, color spaces, bitmap images) to reduce the file size.


Note:

If the PDF file only has few resources, compression will be low.

It makes sense to use this parameter if:

  • there are duplicate images
  • a PDF file is to be compressed, that was previously merged from several documents


Possible values:

  • true: Merges duplicate resources.
  • false: Does not merge duplicate resources.
quantize

Quantizes images using the parameters numColors and alphaThreshold. If the parameter quantize is set, also the parameter numColors and alphaThreshold have to be set.


Note:

In some cases, the parameter quantize can lead to an increase in file size and change the quality and transparency of the images in the PDF. This parameter should not be set if high-resolution images are desired in the PDF.

Possible values:

  • true: Quantizes images.
  • false: Images are not quantized.
numColors

The number of colors in images in a PDF. This parameter indicates to which number the number of colors in the PDF shall be reduced to. The values must be a power of two (2n).

Possible values:

  • 256 (default)
  • Integer
alphaThreshold

Specifies how the transparency is to be handled. Values above 128 lead to higher transparency, values below to lower transparency.

Possible values:

  • 128 (default)
  • Integer


Status values

1

The operation has been executed successfully.

0The operation has been executed successfully, but without result.
-1

The adapter could not be executed.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.