QRCode

Use the QRCode library to generate a QR code graphic that links to a specified URL. For example, you could generate a QR code for a UCI button that, when scanned with a smartphone, takes the user to a website that provides instructions for using a conference room.

QRCode.GenerateSVG

Generate a QR code SVG graphic.

Syntax

QRCode.GenerateSVG('url', ['mode'])

Arguments

url : The URL string to encode.

mode : Optional error correction mode string. Replace with low, medium, quartile, or high. Defaults to "medium" if not passed.

Example

In this example, Text Controller is configured as follows to generate a QR code:

Copy
Text Controller Script
json = require("rapidjson")
Controls.mode.Choices = {"low", "medium", "quartile", "high"}


function generate()

  local svg = QRCode.GenerateSVG(Controls.url.String, Controls.mode.String)
  
  legend = {
    DrawChrome = false,
    IconData = Crypto.Base64Encode(svg)
  }

  Controls.graphic.Legend = json.encode(legend)
end

Controls.mode.EventHandler = generate
Controls.url.EventHandler = generate

generate()