There are a lot of services that generate QR codes. In this article, we use this service to generate QR code image with Send HTTP request action and use this image in the Document Generator template:
1. Add Send HTTP request action with the API request to generate QR code in base64 image.
https://api.qrgenerator.sk/by-square/pay/base64?format=png&iban=SK8975000000000012345671&amount=10¤cy=EUR&vs=20200001&payment_note=poznamka&due_date=2023-05-03&unit_size=10
2. Create a new variable using the Variables button (in this example the variable is named "QRBase64"). In the Set variable action, add the expression below to the selected variable. In this expression we build a URL in base 64 format: "data:image/png;base64," and use the output from previously executed HTTP request action:
="data:" + [[@Actions.SendHTTPrequest.ResponseBody]].mime + ";base64," + [[@Actions.SendHTTPrequest.ResponseBody]].data
3. Add a Generate document action. In the Document Generator template (Word document) add the created variable to the image placeholder:
[[image ([[@Variables.QRBase64]], 150, 150)]]
The full example of the actions for import can be downloaded here
Note: For the case if service returns the image as a stream or bytes it can be achieved by storing this image in Site Assets library using Execute script or Send HTTP request action. Then you can use this image placeholder in the Document Generator template (Word document):
[[image ([[@Variables.ImageURLFromSiteAssets]], 150, 150)]]