X4 Produktdokumentation

PDF Compression: Functions and Operations

This adapter compresses PDF documents that exceed a certain size. Documents smaller than 100 KB are only slightly compressed, so the file size can hardly be reduced with the adapter.

Note:

To properly compress the PDF document, at least one of the following parameters must be set in the PDF Compression Adapter:

  • regularCompression

  • maximumCompression

  • xRefCompression

  • mergeResources

  • quantizewith the numColors and alphaThreshold parameters

Properties

Operation

Here, you specify which operation the adapter performs.

Possible values:

  • Compress: Compress the PDF document


Parameters

documentPassword

(optional)

Password used to encrypt the PDF document

Possible values:

String in the format of the password

regularCompression

The PDF is reduced by regular compression.

Note:

A low compression is to be expected if only this parameter is set.

Possible values:

  • true: The PDF is reduced by regular compression.

  • false: The PDF is not reduced using regular compression.

maximumCompression

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

Note:

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

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 with a compressed xRef table (cross reference table). This option is only valid for PDFs from version 1.6 or later. This option is not compatible with PDF/A-1 documents.

Note:

Activating this parameter can increase the runtime. This parameter saves 5 to 15% of the file size unless the PDF document to be compressed has been previously compressed with xRef Compression.

Possible values:

  • true: The PDF is saved with a compressed xRef table.

  • false: The PDF is not saved with a compressed xRef table.

mergeResources

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

Note:

If the PDF document contains few resources, the compression is low.

It is useful to use this parameter if:

  • Images are duplicated

  • a PDF document that has previously been merged from multiple PDF documents is to be compressed

Possible values:

  • true: Merges duplicate content.

  • false: Does not merge duplicate content.

quantize

Quantizes images using numColors and alphaThreshold parameters.

Therefore, if the quantize parameter is set, the numColors and alphaThreshold parameters must also be set.

Note:

The quantize parameter can in some cases result in file enlargement and can change the quality and transparency of the images present 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 the PDF that you want to reduce to. The values must be a power of two (2n).

Possible values:

  • 256 (default)

  • Integer (integer)

alphaThreshold

Defines how the transparency is to be handled. Values above 128 result in greater transparency, values below in lower transparency.

Possible values:

  • 128 (default)

  • Integer


Status values

1

The operation was successful.

0

The operation was executed successfully, but without results.

-1

The operation could not be performed.