How to use QR code image in the Document Generator template

How to use QR code image in the Document Generator template

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.

HTTP_request.png

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 found below in the appendix.

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)]]

    • Related Articles

    • Introduction to Document Generator

      What is the document generator? The "Document Generator" allows you to generate documents based on a standard Microsoft Word file filled with SharePoint list data. This can be triggered in actions used in list actions, modern forms or background ...
    • How to handle the lookup columns threshold in a Document Generator template for a single item

      f your Document Generator Template contains more than 12 lookups that exceeds the SharePoint lookup column threshold, you may face the situation that the generated document may not include all lookup values. To overcome this problem we propose the ...
    • Action: Generate document

      Generate document action allows you to generate documents based on a standard Microsoft Word file filled with SharePoint list data. For more information about Action Builder read Action Builder Introduction article. For more information about ...
    • How to use query functions

      Context placeholder functions allow querying lists so that values from any list can be used in expressions. I.e. [[@Web.GetFirstValueForQuery('ListName, list Id or Relative URL', 'Caml query', 'FieldName')]].     List parameter The ...
    • Teamsware Studio Update 28.03.2024

      New features Generate QR code action Added Generate QR code action for Scheduled & Triggered Actions Insert image to PDF action Added Insert image to PDF action for Schedule & Triggered Actions Insert CAML query/query functions in Expression Builder ...