Documentation

qrcode.php

Tags
file

Class to create QR-code arrays for TCPDF class. QR Code symbol is a 2D barcode that can be scanned by handy terminals such as a mobile phone with CCD. The capacity of QR Code is up to 7000 digits or 4000 characters, and has high robustness. This class supports QR Code model 2, described in JIS (Japanese Industrial Standards) X0510:2004 or ISO/IEC 18004. Currently the following features are not supported: ECI and FNC1 mode, Micro QR Code, QR Code model 1, Structured mode.

This class is derived from "PHP QR Code encoder" by Dominik Dzienia (http://phpqrcode.sourceforge.net/) based on "libqrencode C library 3.1.1." by Kentaro Fukuchi (http://megaui.net/fukuchi/works/qrencode/index.en.html), contains Reed-Solomon code written by Phil Karn, KA9Q. QR Code is registered trademark of DENSO WAVE INCORPORATED (http://www.denso-wave.com/qrcode/index-e.html). Please read comments on this class source file for full copyright and license information.

author

Nicola Asuni

version
1.0.010

Table of Contents

Classes

QRcode

Constants

MAX_STRUCTURED_SYMBOLS  = 16
Max number of symbols for structured mode
N1  = 3
Down point base value for case 1 mask pattern (concatenation of same color in a line or a column)
N2  = 3
Down point base value for case 2 mask pattern (module block of same color)
N3  = 40
Down point base value for case 3 mask pattern (1:1:3:1:1(dark:bright:dark:bright:dark)pattern in a line or a column)
N4  = 10
Down point base value for case 4 mask pattern (ration of dark modules in whole)
QR_DEFAULT_MASK  = 2
when QR_FIND_BEST_MASK === false
QR_ECLEVEL_H  = 3
Error correction level H : About 30% or less errors can be corrected.
QR_ECLEVEL_L  = 0
Error correction level L : About 7% or less errors can be corrected.
QR_ECLEVEL_M  = 1
Error correction level M : About 15% or less errors can be corrected.
QR_ECLEVEL_Q  = 2
Error correction level Q : About 25% or less errors can be corrected.
QR_FIND_BEST_MASK  = \true
if true, estimates best mask (spec. default, but extremally slow; set to false to significant performance boost but (propably) worst quality code
QR_FIND_FROM_RANDOM  = 2
if false, checks all masks available, otherwise value tells count of masks need to be checked, mask id are got randomly
QR_MODE_8B  = 2
Encoding mode 8bit byte data. In theory, 2953 characters or less can be stored in a QRcode.
QR_MODE_AN  = 1
Encoding mode alphanumeric (0-9A-Z $%*+-./:) 45characters. 2 characters are encoded to 11bit length. In theory, 4296 characters or less can be stored in a QRcode.
QR_MODE_KJ  = 3
Encoding mode KANJI. A KANJI character (multibyte character) is encoded to 13bit length. In theory, 1817 characters or less can be stored in a QRcode.
QR_MODE_NL  = -1
Encoding mode
QR_MODE_NM  = 0
Encoding mode numeric (0-9). 3 characters are encoded to 10bit length. In theory, 7089 characters or less can be stored in a QRcode.
QR_MODE_ST  = 4
Encoding mode STRUCTURED (currently unsupported)
QRCAP_EC  = 3
Matrix index to get error correction level from $capacity array.
QRCAP_REMINDER  = 2
Matrix index to get remainder from $capacity array.
QRCAP_WIDTH  = 0
Matrix index to get width from $capacity array.
QRCAP_WORDS  = 1
Matrix index to get number of words from $capacity array.
QRCODEDEFS  = \true
Indicate that definitions for this class are set
QRSPEC_VERSION_MAX  = 40
Maximum QR Code version.
QRSPEC_WIDTH_MAX  = 177
Maximum matrix size for maximum version (version 40 is 177*177 matrix).
STRUCTURE_HEADER_BITS  = 20
Number of header bits for structured mode

Constants

MAX_STRUCTURED_SYMBOLS

Max number of symbols for structured mode

public mixed MAX_STRUCTURED_SYMBOLS = 16

N1

Down point base value for case 1 mask pattern (concatenation of same color in a line or a column)

public mixed N1 = 3

N2

Down point base value for case 2 mask pattern (module block of same color)

public mixed N2 = 3

N3

Down point base value for case 3 mask pattern (1:1:3:1:1(dark:bright:dark:bright:dark)pattern in a line or a column)

public mixed N3 = 40

N4

Down point base value for case 4 mask pattern (ration of dark modules in whole)

public mixed N4 = 10

QR_DEFAULT_MASK

when QR_FIND_BEST_MASK === false

public mixed QR_DEFAULT_MASK = 2

QR_ECLEVEL_H

Error correction level H : About 30% or less errors can be corrected.

public mixed QR_ECLEVEL_H = 3

QR_ECLEVEL_L

Error correction level L : About 7% or less errors can be corrected.

public mixed QR_ECLEVEL_L = 0

QR_ECLEVEL_M

Error correction level M : About 15% or less errors can be corrected.

public mixed QR_ECLEVEL_M = 1

QR_ECLEVEL_Q

Error correction level Q : About 25% or less errors can be corrected.

public mixed QR_ECLEVEL_Q = 2

QR_FIND_BEST_MASK

if true, estimates best mask (spec. default, but extremally slow; set to false to significant performance boost but (propably) worst quality code

public mixed QR_FIND_BEST_MASK = \true

QR_FIND_FROM_RANDOM

if false, checks all masks available, otherwise value tells count of masks need to be checked, mask id are got randomly

public mixed QR_FIND_FROM_RANDOM = 2

QR_MODE_8B

Encoding mode 8bit byte data. In theory, 2953 characters or less can be stored in a QRcode.

public mixed QR_MODE_8B = 2

QR_MODE_AN

Encoding mode alphanumeric (0-9A-Z $%*+-./:) 45characters. 2 characters are encoded to 11bit length. In theory, 4296 characters or less can be stored in a QRcode.

public mixed QR_MODE_AN = 1

QR_MODE_KJ

Encoding mode KANJI. A KANJI character (multibyte character) is encoded to 13bit length. In theory, 1817 characters or less can be stored in a QRcode.

public mixed QR_MODE_KJ = 3

QR_MODE_NL

Encoding mode

public mixed QR_MODE_NL = -1

QR_MODE_NM

Encoding mode numeric (0-9). 3 characters are encoded to 10bit length. In theory, 7089 characters or less can be stored in a QRcode.

public mixed QR_MODE_NM = 0

QR_MODE_ST

Encoding mode STRUCTURED (currently unsupported)

public mixed QR_MODE_ST = 4

QRCAP_EC

Matrix index to get error correction level from $capacity array.

public mixed QRCAP_EC = 3

QRCAP_REMINDER

Matrix index to get remainder from $capacity array.

public mixed QRCAP_REMINDER = 2

QRCAP_WIDTH

Matrix index to get width from $capacity array.

public mixed QRCAP_WIDTH = 0

QRCAP_WORDS

Matrix index to get number of words from $capacity array.

public mixed QRCAP_WORDS = 1

QRCODEDEFS

Indicate that definitions for this class are set

public mixed QRCODEDEFS = \true

QRSPEC_VERSION_MAX

Maximum QR Code version.

public mixed QRSPEC_VERSION_MAX = 40

QRSPEC_WIDTH_MAX

Maximum matrix size for maximum version (version 40 is 177*177 matrix).

public mixed QRSPEC_WIDTH_MAX = 177

STRUCTURE_HEADER_BITS

Number of header bits for structured mode

public mixed STRUCTURE_HEADER_BITS = 20

        
On this page

Search results