GenerateQRCode

(Engine-Level Function)

Description: Returns a 2D array which represents a QR code for a given string.
Returns: Array
Usage: Script or steady state.
Function Groups: Array
Related to: | DrawQRCode |
Format: GenerateQRCode(Input[, ECL])
Parameters:  
Input
Buffer for which to generate the QR code
ECL
Error Correction Level, 0 to 3. Default = 0
Comments:

GenerateQRCode will encode any string, so long as that string is shorter than the maximum length for its type.

The maximums will be lower if a non-zero error correction level is selected. With an ECL of 0, the maximums are:

Type Definition Maximum
Numerics 0 - 9 7089 characters
Alphanumerics 0 - 9, A - Z, Some special characters. 4296 characters
Binaries All ascii characters 2953 characters.

A higher ECL will allow more of the QR code to be obscured while still correctly scanning. The level must be an integer, 0 to 3 inclusive.

This function will return metadata even if the returned array is invalid.
The returned metadata includes Error, Mode, Version, ECL, Bytes, Dimension, Mask, and Penalty.

If GenerateQRCode returns Invalid, check the error code.
There are two possible errors:

1 = Bad parameters.
2 = Too many characters.

Examples:

Steady-state example

Main [
  Code = System.GenerateQRCode("https://www.vtscada.com/" { Input }, 2 { Error correction level });
  System.DrawQRCode(Code, 300, 300, Size, Color, Space);
]

Script example

Init [
  If 1 Main;
  [
    Code = System.GenerateQRCode("https://www.vtscada.com/" { Input }, 2 { Error correction level });
  ]
]

Main [
  System.DrawQRCode(Code, 300, 300, Size, Color, Space);
]