It is possible to insert images from the data. In contrast to other bindings, the picture content control (referred to as picture cc from here on) is used instead of the rich text content control. Like with other bindings, the binding JSON object is added to the created content control’s tag.
Syntax
{ "BindingType": "FillImage/FitImage/StretchImage", "BindingKey": "ImagePath", "BindingHyperlink": "HyperlinkPath" }
Parameters
BindingType: An image binding has three possible BindingTypes
:
- FillImage
The image will be cropped so that it can fill out the entire picture cc in the template. - FitImage
The entire image will be shown inside of the picture cc. Any empty space that there might be, will be filled out with transparent color. - StretchImage
The entire image will be shown inside of the picture cc. If there is any empty space, the image will be stretched to fill out the picture cc.
If, beforehand, the ratio of the image’s dimensions is known, e.g. width and height is the same size, it is recommended to set the picture cc to the same ratio. In this case all three BindingTypes will result have the same result. All three types have the same parameters.
ImagePath: A string that is either a base64 string or a public url. If it is an url the image will be downloaded and embedded in the generated document. A url is recommended as this approach will ensure better performance.
HyperlinkPath: A string which is an url. The parameter is optional. If the parameter is included, the url will be added to the image as a link.