jQuery QR Code API

Two dimensional barcodes allows scanning not only from left to right, but also from top to bottom simultaneously.
This increases dramatically the data density of the text, which can be encoded in a single barcode.
A simple declaration for the control looks like this:

    mode: "numeric",
    value: "12345",
    size: 150,
    style: {
        background: "green",
        borderColor: "red",
        borderStyle: "dashed",
        borderWidth: 1,
        color: "yellow",
        padding: 5

The properties of the QR Code control are:

  • mode specifies the type of QR code, which will be rendered. Possible values are “numeric”, “alphanumeric” and “byte”.
    Numeric mode includes the digits 0 to 9.
    Alphanumeric mode is for the decimal digits (0-9), as well as uppercase letters. Lowercase letters are not allowed. Additionally, the alphanumeric mode includes the symbols $, %, *, +, -, ., /, and : as well as a space.
    Byte mode, by default, is for characters from the ISO-8859-1 character set.
  • value specifies the text, which will be encoded by the QR component. For example, a numeric-type QR code accepts only digits (0-9).
    It is important to include only valid characters, as adding invalid ones would raise an exception.
  • size determines the size, in pixels of the QR code. When rendering lots of data, you may increase the size, in order to increase individual module visibility.
  • style contains settings, related to the visual appearance of the control, such as padding, color and border settings.
  • errorLevel determines the error correction level for the QR control.
    QR codes support four levels of error correction to enable recovery of missing, misread, or obscured data. Greater redundancy is achieved at the cost of being able to store less data.

    These levels are referred to by letter:

    L - Allows recovery of up to 7% data loss
    M - Allows recovery of up to 15% data loss
    Q - Allows recovery of up to 25% data loss
    H - Allows recovery of up to 30% data loss

    In practical use, lower error levels generate simpler codes, which means that they can be printed smaller and still resolved by cellphone camera optics.

The methods of the QR Code control are:

  • destroy - destroys the instance of the QR Code widget.
  • refresh - reloads the current instance of the QR Code widget.
    The optional parameter options gives the possibility to extend the initial options with the new ones.

The following example demonstrates some of the properties of the QR Control in action.