Skip to content

Convert PDF to grayscale

The “Convert PDF to grayscale” service task converts a color PDF document into a pure grayscale version. PDFs can be de-colored automatically before physical mailing (for example via the Deutsche Post hybrid letter integration) or printing, without any manual rework in external tools.

Typical use cases:

  • Preparing invoices or cover letters for physical letter print
  • Reducing the file size of color scans for archiving and forwarding
  • Standardizing attachments before sending via hybrid letter or fax

Configuration in the process designer

In the process designer, a small dialog is opened via the “Pick input file” button. A JSONata expression is stored there to define which file from the process message should be converted to grayscale.

Default value: $.document

Further examples:

Expression Meaning
$.document The file is located in the document field of the process message.
$.attachment The file is located in the attachment field.
$.files[0] First element of a file list.
$.invoice.pdf Nested path inside the process message.

The expression must return a file object that contains at least a referenceId field.

Input parameters

The JSONata expression is evaluated at runtime and produces the following input record for the service:

{
  "referenceId": "abc-123-file-reference",
  "filename": "Invoice-2026-0001.pdf",
  "contentType": "application/pdf"
}

Explanation:

  • referenceId: Unique reference to the source PDF in the Pantarey file storage (mandatory).
  • filename: Original file name (optional, reused for the output file).
  • contentType: MIME type of the source file (optional).

Output

The task returns a reference to the newly created grayscale PDF.

{
  "referenceId": "xyz-789-grayscale-reference",
  "filename": "Invoice-2026-0001_grayscale.pdf",
  "contentType": "application/pdf"
}

Explanation:

  • referenceId: Reference to the newly created grayscale PDF.
  • filename: File name of the generated file.
  • contentType: Always application/pdf.

JSONata examples

Select the input file from a nested field of the process message:

$.invoice.generatedPdf

Select the first element of a file list:

$.attachments[0]

Notes

  • Only one file is processed per task execution. For multiple files use a loop (multi-instance).
  • The input file must be a PDF.
  • The service creates a new file – the original remains unchanged in storage.
  • For loops / multi-instance tasks the JSONata expression is re-evaluated for every iteration, so each instance can pick its own file.

Tip

Combined with Send hybrid letter (Deutsche Post) an end-to-end mailing workflow can be built: generate PDF → convert to grayscale → send as hybrid letter. This reliably avoids extra charges for color pages.

To test JSONata expressions, use the JSONata Playground.