Additional transformers can be defined in new JSON or YAML files and specified through environment variables with the TRANSFORMER_ROUTES_ADDITIONAL_ prefix:
export TRANSFORMER_ROUTES_ADDITIONAL_<name>="/path/to/the/additional/route/file.yaml"
Note
The <name> suffix can be a random string. It doesn't need to match any other labels - it just differentiates multiple additional route files.
Here's example content of an additional pipeline in JSON format (same as the transformer-pipelines.json) provided. The environment variable TRANSFORMER_ROUTES_ADDITIONAL_OFFICE_TO_IMAGE="/additional.json", and the additional.json file could be:
{
"transformers": [
{
"transformerName": "pdfToImageViaPng",
"transformerPipeline": [
{
"transformerName": "pdfrenderer",
"targetMediaType": "image/png"
},
{
"transformerName": "imagemagick"
}
],
"supportedSourceAndTargetList": [],
"transformOptions": [
"pdfRendererOptions",
"imageMagickOptions"
]
}
]
}
Here's example content of an additional pipeline in YAML format. This is the same pipeline as in the JSON example. The environment variable TRANSFORMER_ROUTES_ADDITIONAL_AI_ROUTES="/additional.json", and the additional.json content could be:
routes:
- transformerName: pdfToImageViaPng
transformerPipeline:
- transformerName: pdfrenderer
targetMediaType: image/png
- transformerName: imagemagick
supportedSourceAndTargetList: []
transformOptions:
- pdfRendererOptions
- imageMagickOptions
Regardless of the format used, the custom pipeline definition files must be mounted on the T-Router container file-system.
Multiple additional pipeline files can be specified. Ideally, for each new custom engine a separate custom pipeline file should be added.
In case of clashes between transformers and their supported transforms:
-
If two transformers support the same source and target media type, the transformer with the higher priority is used (i.e. a lower numeric value is considered higher priority).
-
If the same transform is specified in multiple transformers with the same transform options, priority and maxSourceFileSize, then one of the transformers will be chosen at random.