convert-document-format
title: ConvertDocumentFormat​
ConvertDocumentFormat
Business goal​
This action converts an uploaded document to another format, so the rest of the platform only ever sees a format it can handle. It is useful for channels that deliver scans in a format the viewer, the document assessment provider or the client cannot open.
Supported conversions​
| From | To |
|---|---|
tif, tiff | JPEG |
Any other pair is refused when the settings are saved.
Behaviour​
- The document record is kept. Only the stored content, the filename extension and the media type change, so assessments, tasks and links to the document survive the conversion.
- A document that matches no rule is left alone. Its extension is simply not in any
fromlist, and the action completes successfully. - A file that cannot be converted stays as it was uploaded. Corrupt files, multi-page TIFFs and images whose decoded size exceeds a 250 MB memory budget (roughly 41 megapixels) are rejected, and the original content is never deleted.
- An unconvertible upload raises no failure report. That is a caller error rather than a platform failure; a conversion that is not supported by the platform is a misconfiguration and is always reported.
Configuration​
- Add the action
ConvertDocumentFormat. - Link it to
DOCUMENT_CREATEDandDOCUMENT_UPDATED. Linking only one of the two leaves the other route unconverted. - Mark the action
synchronous. Synchronous actions run before the asynchronous actions of the same event, which is what lets PerformDocumentAssessment read the converted file instead of the original. - Allow the source extension on the document's field definition. An extension that is not allowed there is refused at upload, before any event is raised.
Example​
{
"type": "EVENT",
"value": "DOCUMENT_CREATED",
"className": "eu.myharmoney.app.bll.executors.events.ConvertDocumentFormat",
"synchronous": true,
"settings": {
"conversions": [
{ "from": ["tif", "tiff"], "to": "JPEG" }
]
}
}