Method 1: Using Base64 Encoding
1. Convert the Image to a Base64 String:
- Retrieve the image from your Mendix application
- Use the Java action 'Base64EncodeFile' from the Community Commons module to convert the image to a base64 string
2. Use the Base64 String in a Merge Field:
- Set the return value from the Java action as the value of an attribute
- Use this attribute in a merge field in your document. The merge field should be formatted as: '«Image:Fieldname»'
Example Microflow:
The microflow retrieves the image, encodes it to base64, and assigns it to the attribute used in the document template.
Method 2: Using Alias and System Check in MXReflex
1. Set Up the Alias:
- Use the alias '_Image_' for the image field in your document template
2. Refresh MXReflex with the System Module:
- Ensure that your MXReflex is refreshed with the System module checked. This is necessary for the alias to work correctly
3. Configure the Merge Field:
- Set the Fieldname as '_Image_'
- Use the XPath 'Contents' for selecting the image data
- The merge field in the document template should look like: '«Image:_Image_»'
Example Microflow:
The microflow should retrieve the image and set it with the appropriate alias for use in the document.