Convert PDF to grayscale
The "Convert PDF to grayscale" service task creates a new file from a color PDF in which every page is an 8-bit grayscale image. Its main purpose is fax dispatch: many fax services cannot process color PDFs correctly and deliver black or empty pages. Send fax calls this conversion automatically; the standalone service is needed when the grayscale file itself is to be reused.
Technical name prio_pdfToGrayscale · Category in the "Select service task" dialog: Documents & PDF · Frequently used
When is this service used?
- Fax with proof: Musterfirma GmbH converts an order confirmation, stores the grayscale file on the record and faxes it with
skipGrayscaleConversion: true. - Several faxes with the same document: A file is converted once and faxed to several recipients in a loop instead of being converted per fax.
- Uniform attachments: Color scans are turned into uniform black-and-white pages before filing or forwarding.
For letters via Send E-Post letter the service is not needed; there iscolor controls color printing.
Configuration in the process designer
The service has its own grayscale block in the properties panel. The status card shows "Input configured – the selected file will be converted to grayscale." or "Input missing – use the button below to define which PDF to convert."
| Setting | Required | Meaning |
|---|---|---|
| Pick input file | Yes | Opens the "Pick input file" dialog: a JSONata expression against the incoming message that returns the file object to convert, at least with referenceId (optional filename, contentType). Examples in the dialog: "Standard case — file under 'document'" ($.document), "File from the field 'attachment'", "First file from a file list" |
There is no technical default value; $.document is just the first example in the dialog. If the expression does not return a file object with referenceId, the step fails with "grayscaleTemplate: expression … must resolve to a file-object with a referenceId". The input expression usually stays $; the expression from Pick input file is applied to its result.
Input
From the chosen expression Pantarey builds this input at runtime:
{
"document": {
"referenceId": "01JXXXXX",
"filename": "Order-confirmation-AB-2026-0107.pdf",
"contentType": "application/pdf"
}
}
| Field | Type | Required | Meaning |
|---|---|---|---|
document |
file object | Yes | the source PDF; if document.referenceId is missing: "prio_pdfToGrayscale: 'document.referenceId' fehlt im inputMessage" |
options.dpi |
number | No | Rasterization resolution, default 300, allowed 72–600 |
Without Pick input file the input is passed through unchanged; the input expression must then itself return the form { "document": { "referenceId": … } }. A flat file object without document does not work. options.dpi can only be set this way, e.g.:
{
"document": $.invoice_result.pdf,
"options": { "dpi": 200 }
}
Output
{
"document": {
"referenceId": "01JYYYYY",
"filename": "Order-confirmation-AB-2026-0107_bw.pdf",
"contentType": "application/pdf"
},
"metadata": {
"totalPages": 2,
"dpi": 300,
"inputBytes": 184320,
"outputBytes": 412688,
"processingTimeMs": 1830,
"engine": "pypdfium2",
"source_document": { "referenceId": "01JXXXXX", "filename": "Order-confirmation-AB-2026-0107.pdf", "contentType": "application/pdf" }
}
}
document: the new grayscale file; filename<stem>_bw.pdf, without a known namedocument_bw.pdf. The original stays unchanged.metadata: page count, resolution, size before and after conversion, duration and the source file.
With the result path grayscale the file is afterwards found under grayscale.document, see Result path.
Errors and behavior
- Errors end the step with an exception: an error boundary event catches them, otherwise the instance fails, see Errors. Typical messages: "'document.referenceId' fehlt im inputMessage", "PDF enthaelt keine Seiten" (empty or damaged file), "dpi muss zwischen 72 und 600 liegen".
- The service runs in the Python environment with a time limit of 300 seconds; there is no functional retry, only infrastructure errors of the call are retried.
- Every page is rasterized: text and vectors become images, the result is no longer searchable, and the file may become larger than the original.
- In a dry run the service is not called; a sample output is inserted, see Dry run.
Example
Musterfirma GmbH faxes an order confirmation available as invoice_result.pdf from Generate PDF from template and wants to store the faxed version on the record.
- Configuration: Pick input file →
$.invoice_result.pdf. - Result path:
grayscale. - Output:
grayscale.documentis the file…_bw.pdf,grayscale.metadata.totalPagesthe page count. - Next step in the process: Send fax with
{ "document": { "referenceId": $.grayscale.document.referenceId }, "recipients": $.customer.fax, "skipGrayscaleConversion": true }; a Database step storesgrayscale.documenton the order.
Frequently asked questions
Why does the step fail although the input expression returns a file?
Without Pick input file the service expects the file under document. Either use the button or change the input expression to { "document": … }.
Is the text in the result still searchable?
No. Every page is rasterized into a grayscale image. For archiving with full-text search keep the original and use the grayscale file only for fax dispatch.
How can the resolution be changed?
Only via the input expression with options.dpi (72–600, default 300), without Pick input file. A lower resolution reduces the file size; 200 dpi is sufficient for fax.
Next step
Send fax: fax the grayscale PDF with
skipGrayscaleConversion: true.