Skip to main content
Version: 19

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​

FromTo
tif, tiffJPEG

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 from list, 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​

  1. Add the action ConvertDocumentFormat.
  2. Link it to DOCUMENT_CREATED and DOCUMENT_UPDATED. Linking only one of the two leaves the other route unconverted.
  3. 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.
  4. 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" }
]
}
}

Settings​

Settings Configuration