Home Page Barcodes for C++
Home
                          RBarcode for C++
                        • Introduction
                        • Documentation
                        • Download
                        • Pricing & Purchase
                        • License

                        • For other languages
                        • AJAX/Javascript
                        • XOJO & Realbasic
                        • Ruby

                        • Related products
                        • RBarcode Vision
                        • Documentation
                          J4L Barcodes for C++

                          J4L Barcoding components for C++

                          Copyright J4L (http://www.java4less.com) 2009.

                          The J4L barcoding components for C++ family currently support the following symbologies:

                          • Linear barcodes
                          • Datamatrix
                          • PDF417 (regular and Macro)
                          • QRCode
                          • Aztec code

                          The components can be used as DLL or compiled inside your own applications since the source code is provided. The components will compile on Windows and Linux using the GNU C++ compiler.

                          The components can produce two kind of outputs:

                          • a bitmap image file (BMP)
                          • or a bitmap as an array of integers which contains the RGB values of the image

                          Linear barcodes

                           

                          Introduction

                          The J4L Barcode 1D C++ class includes the following 1D symbologies:

                          • Code 128
                          • Code 39 (regular and extended)
                          • Code 11
                          • Codabar
                          • Code 93 (regular and extended)
                          • EAN 128
                          • EAN 13
                          • EAN 8
                          • UPC E and UPC A
                          • Interleaved 2 of 5
                          • Industrial 2 of 5
                          • Postnet
                          • MSI
                          • Matrix 2 of 5

                          Test application

                          The product includes a small demo application which creates windows EMF files. The program is called 1dConsole.exe and supports the following options

                          • -file: output bmp file
                          • -code: value to encode
                          • -height: bar height
                          • -code128Set: A, B or C
                          • -type: barcode type (0-code39, 1-code39 extended, 2-Interleaved25, 3-code11, 4 codebar, 5 MSI, 6 UPCA, 7-Industrial 2of5, 8-Matrix 2of5, 9-code93, 10-EAN13, 11-EAN8, 12-UPCE, 13-Code128, 14-Code93 extended, 15-Postnet, 16-EAN128)

                          example:

                          1DConsole.exe -code 123456 -type 13 -height 40 -file barcode.emf

                          will encode the value 123456 using the code128 symbology.

                           

                          C++ source code

                          If you want to compile the source code together with your C++ application you can use the following code for creating a windows emf  file:

                          J4LBarcode1D* m= new J4LBarcode1D();
                          m->code="123456";
                          m->barType=13; // code 128
                          m->processTilde=true;
                          m->checkCharacter=true;
                          m->paint();

                          Metafile* bmp= new Metafile();
                          string filename="output.emf";
                          const char* s=m->codeText.c_str();
                          bmp->write1DWithText(filename.c_str(),m->getWidthsArray(),m->getHeightsArray(),m->getArrayLength(),s,20,m->codeText.length());

                          delete bmp;

                          delete m;

                           

                          Datamatrix

                          Data Matrix is a two-dimensional (2D) matrix symbology which is made up of square modules arranged within a perimeter finder pattern. It can encode up to 3116 characters from the entire 256 byte ASCII character set. The symbol consists of data regions which contain square modules set out in a regular array. Large ECC 200 symbols contain several regions. Each data region is delimited by a finder pattern, and this is surrounded on all four sides by a quiet zone border (margin).

                           

                           

                          ECC 200 symbols have an even number of rows and an even number of columns. Most of the symbols are square with sizes from 10 x 10 to 144 x 144. Some symbols however are rectangular with sizes from 8 x 18 to 16 x 48. All ECC 200 symbols can be recognized by the upper right corner module being light (binary 0).

                          ECC200 is the newest version of data matrix and supports advanced encoding error checking and correction algorithms (reed-solomon). This algorithms allow the recognition of barcodes that are up to 60% damaged.

                          The barcode supports two optional mechanisms:

                          • The "Extended Channel Interpretation" (ECI) mechanism enables characters from other character sets (e.g. Arabic, Cyrillic ..) and other data interpretations or industry-specific requirements to be represented.
                          • The "Structured append" allows files of data to be represented as a secuence of up to 16 Data Matrix symbols. The original data or file can be reconstructed regardless of the order of the symbols.

                          RDataMatrix supports:

                          • All sizes and formats (from 10x10 till 144x144)
                          • Ascii, text , C40 and Base256 (for binary data) encoding.
                          • The "Extended Channel Interpretation and Structured append

                          Formats

                          RDataMatrix supports all data matrix formats. The following table contains the size , the capacity and the correction error features of each format:

                          Size

                          Numeric Capacity

                          Alphanumeric capacity

                          Binary capacity

                          Max Correctable

                          Error/Erasure

                          10 x 10

                          6

                          3

                          1

                          2

                          12 x 12 10 6 3 3
                          14 x 14 16 10 6 5/7
                          16 x 16 24 16 10 6/9

                          18 x 18

                          36

                          25

                          16

                          7/11

                          20 x 20 44 31 20 9/15

                          22 x 22

                          60

                          43

                          28

                          10/17

                          24 x 24

                          72

                          52

                          34

                          12/21

                          26 x 26

                          88

                          64

                          42

                          14/25

                          32 x 32 124 91 60 18/33
                          36 x 36 172 127 84 21/39
                          40 x 40 228 169 112 24/45
                          44 x 44 288 214 142 28/53
                          48 x 48 348 259 172 34/65
                          52 x 52 408 304 202 42/78
                          64 x 64 560 418 278 56/106
                          72 x 72 736 550 366 72/132
                          80 x 80 912 682 454 96/180
                          88 x 88 1152 862 574 112/212
                          96 x 96 1392 1042 694 136/260
                          104 x 104 1632 1222 814 168/318
                          120 x 120 2100 1573 1048 204/390
                          132 x 132 2608 1954 1302 248/472
                          144 x 144 3116 2335 1556 310/590
                          8 x 18 10 6 3 3
                          8 x 32 20 13 8 5
                          12 x 26 32 22 14 7/11
                          12 x 36 44 31 20 9/15
                          16 x 36 64 46 30 12/21
                          16 x 48 98 72 47 14/25

                          Encoding

                          The data represented in the symbol can be compressed using one or several of the following algorithms:

                          • ASCII: it is used to encode data that mainly contains ascii characters (0-127). It encodes one alphanumeric or two numeric characters per byte.
                          • C40: it is used to encode data that mainly contains numeric and upper case characters. C40 encodes three alphanumeric data characters into two bytes.
                          • TEXT: it is used to encode data that mainly contains numeric and lowercase characters. TEXT encodes three alphanumeric data characters into two bytes.
                          • BASE256: it is used to encode 8 bit values.

                          All encoding system can be used to encode any data, but for example, encoding binary data with C40 generates much more overhead (longer symbol) than with BASE256.

                          Control characters

                          RDataMatrix uses the character ~ to recognize some special characters in the input data. The following possibilities are available:

                          • ~X is used to represent character values from 0 to 26. Replace the X like in the following example ~@ = means character ascii 0, ~A= means character 1, ~B=means character 2, ~C=means character 3 ...
                          • ~1: represents the character FNC1. When FNC1 appears in the first position (or in the fifth position of the first symbol of a Structured Append), it will indicate that the data conforms to the UCC/EAN Application Identifier standard format.
                          • ~2: It is used to represent Structured Append. Structured Append is used to link information from several symbols in a secuence. The ~2 must be followed by 3 additional bytes. The first 4 bits of the first byte identify the position of the particular symbol in the secuence . The last 4 bits identify the total number of symbols in the secuence. The second and third bytes are used as a file identifier are can have a value between 1 and 254 (up to 254*254=64516 identifiers). See Data Matrix Specification for more information about this (ISO 16022).
                          • ~3: This character is only allowed in the first position of the symbol. It indicates that the data contains commands for the barcode reader.
                          • ~4: not allowed.
                          • ~5 and ~6: These characters are only allowed in the first position of the symbol. If ~5 is used the header [)> ascii30 ascii05 ascii29 will be transmitted by the barcode reader before the data in the symbol and the trailer ascii30 ascii04 will be transmitted after the data. If a ~6 is used , the header [)> ascii30 ascii05 ascii29 will be transmittedby the reader before the data and the trailer ascii30 ascii04 will be transmitted afterwards.
                          • ~7NNNNNN specifies the Extended Channel to be used, where NNNNNN is a value between and 000000 - 999999. For example: ~7000010 means Extended Channel 10 . Extended channel is used for using other character sets other than ascii. See Data Matrix Specification for more information about this (ISO 16022).
                          • ~dNNN represents the ascii character encoded by the 3 digits NNN. For exmaple, ~d065 represents the character 'A'.

                          Test application

                           

                          The product includes a small demo application which creates BMP files. The program is called datamatrix.exe and supports the following options

                          • -file: output bmp file
                          • -encoding: (see table below)
                          • -format: (see table below)
                          • -code: value to encode
                          • -dataFile: input file which contains the value to encode

                          example:

                          datamatrix.exe -file datamatrix.bmp -encoding 0 -format 0 -code 1234567890

                          will encode the value 1234567890 using ASCII encoding.

                           

                          DLL

                           

                          The DLL file datamatrix.dll has one entry point defined as:

                          void createDatamatrix(char format,char encoding,unsigned short int dataLen,char* data,char* file);

                          where:

                          • format: see table below
                          • encoding: see table below
                          • dataLen: length of data to be encoded
                          • data: pointer to the data to be encoded
                          • file: name of the BMP file to be created

                           

                          The following Visual Basic 6.0 code shows how to call the DLL :

                           

                          Private Declare Sub createDatamatrix Lib "datamatrix.dll" (ByVal format As Byte, ByVal encoding As Byte, ByVal datalen As Integer, FirstDataElement As Byte, name As Byte)

                          .......

                          Dim data(100) As Byte
                          Dim file(100) As Byte
                          Dim format As Byte
                          Dim encoding As Byte
                          Dim dataLen As Byte
                          Dim h As Integer

                          file(0) = Asc("c")
                          file(1) = Asc(":")
                          file(2) = Asc("\")
                          file(3) = Asc("a")
                          file(4) = Asc(".")
                          file(5) = Asc("b")
                          file(6) = Asc("m")
                          file(7) = Asc("p")
                          file(8) = 0

                          dataLen = 100 ' encode 100 A
                          For h = 0 To i - 1
                          data(h) = Asc("A")
                          Next

                          format = 1
                          encoding= 3 ' base265

                          createDatamatrix format, encoding, i, data(0), file(0)

                           

                          C++ source code

                           

                          If you want to compile the source code together with your C++ application you can use the following code for creating a bmp file:

                          string filename="c:\\datamatrix.bmp";

                          RDatamatrix* m= new RDatamatrix();

                          m->codeBinary=d;
                          m->codeBinaryLength=dataLen;
                          m->encoding=3;
                          m->preferredFormat=0;

                          m->paint();

                          // create now bmp file

                          bitmapfile* bmp= new bitmapfile();
                          bmp->write(filename,m->bitmap,m->rows,m->cols);

                          delete bmp;
                          delete m;

                          if you want to read the datamatrix bitmap array instead of create a bmp file you must use:

                          m->getBitmapEntry(col,row);

                          where:

                          • 0<= col < m->cols
                          • 0<= row < m->rows

                           

                          Datamatrix  
                          Encoding
                          Value
                          ASCII
                          0
                          C40
                          1
                          TEXT
                          2
                          BASE256
                          3
                          AUTO
                          5

                           

                          Datamatrix  
                          Format
                          Value
                          C10x10
                          0
                          C12x12
                          1
                          C14x14
                          2
                          C16x16
                          3
                          C18x18
                          4
                          C20x20
                          5
                          C22x22
                          6
                          C24x24
                          7
                          C26x26
                          8
                          C32x32
                          9
                          C36x36
                          10
                          C40x40
                          11
                          C44x44
                          12
                          C48x48
                          13
                          C52x52
                          14
                          C64x64
                          15
                          C72x72
                          16
                          C80x80
                          17
                          C88x88
                          18
                          C96x96
                          19
                          C104x104
                          20
                          C120x120
                          21
                          C132x132
                          22
                          C144x144
                          23
                          C8x18
                          24
                          C8x32
                          25
                          C12x26
                          26
                          C12x36
                          27
                          C16x36
                          28
                          C16x48
                          29

                           

                           

                          PDF417

                          PDF stands for “Portable Data File.” A two-dimensional symbology (2D), a single PDF417 symbol carries up to 1.1 kilobytes of machine-readable data in a space no larger than a standard bar code. And, unlike one-dimensional bar codes (1D), which are just a key linked to a database, PDF417 symbols contain the database itself. That means, you don't have to store an article number in the barcode but you can also store the name , the size , the color, the name of the manufacturer etc...

                          RPDF417 support:

                          • PDF417
                          • Marco PDF 417. This version allows to concatenate several PDF417 symbols in order to encode larger amount of information.
                          • Compact/Truncated PDF417. This is a smaller version of PDF417 which can be used in clean environments.

                           

                          Formats

                          The symbol has the following format:

                          • Number of rows: 3 to 90
                          • Number of columns 1 to 30

                          where number of rows * number of columns must be <= 928.

                          Each symbol character is made of 17 modules, 4 bars and 4 space elements (bars), with the largest element 6 modules wide.

                          The maximum possible number of data characters per symbol (at error correction level 0) is:

                          • Text Compaction mode: 1 850 characters
                          • Byte Compaction mode: 1 108 characters

                           

                          Encoding

                          The data represented in the symbol can be compressed using one or several of the following algorithms:

                          • BINARY: it can encode any character between 0 and 255.
                          • TEXT: The Text Compaction mode includes all the printable ASCII characters (i.e. values from 32 to 126) and three ASCII control characters: HT or tab (ASCII value 9), LF or line feed (ASCII value 10), and CR or carriage return (ASCII value 13).
                          • NUMERIC: encodes digits only.

                           

                          Test application

                           

                          The product includes a small demo application which creates BMP files. The program is called pdf417.exe and supports the following options

                          • -file: output bmp file
                          • -mode: see table below
                          • -cols: number of columns in the symbol (any value between 1 and 30).
                          • -rows: maximum number of rows in the symbol (any value between 3 and 90).
                          • -eclevel: values between 0 and 8.
                          • -code: value to encode
                          • -dataFile: input file which contains the value to encode

                          example:

                          pdf417.exe -file pdf417.bmp -mode 0 -cols 10 -eclevel 3 -code 1234567890

                          will encode the value 1234567890 using BYTE encoding.

                           

                          DLL

                          The DLL file pdf417.dll has one entry point defined as:

                          void createPDF417(char cols,char rows,char maxrows,char mode,char eclevel,unsigned short int dataLen,char* data,char* file)

                          where:

                          • cols: number of columns in the symbol (any value between 1 and 30).
                          • rows: number of rows in the symbol (any value between 3 and 90).
                          • maxrows: maximum number of rows in the symbol (any value between 3 and 90).
                          • mode: see table below
                          • eclevel: values between 0 and 8.
                          • dataLen: length of data to be encoded
                          • data: pointer to the data to be encoded
                          • file: name of the BMP file to be created

                           

                          The following Visual Basic 6.0 code shows how to call the DLL :

                           

                          Private Declare Sub createPDF417 Lib "pdf417.dll" (ByVal cols As Byte, ByVal rows As Byte, ByVal maxrows As Byte, ByVal mode As Byte, ByVal level As Byte, ByVal datalen As Integer, FirstDataElement As Byte, name As Byte)

                           

                          .......

                          Dim data(100) As Byte
                          Dim file(100) As Byte
                          Dim dataLen As Byte
                          Dim h As Integer


                          file(0) = Asc("c")
                          file(1) = Asc(":")
                          file(2) = Asc("\")
                          file(3) = Asc("a")
                          file(4) = Asc(".")
                          file(5) = Asc("b")
                          file(6) = Asc("m")
                          file(7) = Asc("p")
                          file(8) = 0

                          dataLen = 100 ' encode 100 A
                          For h = 0 To i - 1
                          data(h) = Asc("A")
                          Next

                          format = 1
                          encoding= 0 ' BYTE


                          createPDF417 3, 3, 10, 0, 1, dataLen, data(0), file(0)

                           

                          C++ source code

                           

                          If you want to compile the source code together with your C++ application you can use the following code for creating a bmp file:

                          string filename="pdf417.bmp";

                          RPDF417* m= new RPDF417();
                          m->code="12345678901234567890123456789012345678901234567890";
                          m->PDFMode=2; //PDF_TEXT;
                          m->PDFColumns=3;
                          m->PDFMaxRows=10;
                          m->PDFECLevel=3;

                          m->paint();

                          // create now bmp file
                          bitmapfile* bmp= new bitmapfile();

                          bmp->write(filename,m->pixelbitmap,m->pixelbitmapHeight,m->pixelbitmapWidth);

                          delete bmp;
                          delete m;

                          if you want to read the datamatrix bitmap array instead of create a bmp file you must use:

                          m->getBitmapEntry(col,row);

                           

                          Macro PDF 417

                          This option allows to concatenate several PDF417 symbols in order to encode large amount of information. This is achieved by encoding several barcodes (segments) which include a Macro PDF 417 control header. The control header contains a file id field which is used to know which barcodes below together, and a segment number to know the sequence of the barcodes. There are other header fields, line sender, timestamp, filename ... which are optional.

                          You can use 2 approches:

                          1. Split the data to be encodes in several chunks and encode each segment as in this example:

                            // this example assumes we encode 2 segments

                            m->codeBinary=inputDataPart1; // data to be encoded , chunk 1
                            m->PDFMacroSegmentCount=2; // number of segment
                            m->PDFMacroSegment=0; // first segment
                            m->PDFMacroLastSegment=false;
                            m->PDFColumns=10; // the size of the barcode (columns and rows) determines the capacity of the symbol (number if bytes that can encode)
                            m->PDFMaxRows=10;
                            m->PDFRows=10;

                            int* fileId=new int[4];
                            fileId[0]=1; // any value for the file id
                            fileId [1]=2;
                            fileId [2]=3;
                            fileId [3]=-1; // last element must be -1
                            m->PDFMacroFileId=fileId;

                            m->paint(); // encode first segment

                            bitmapfile* bmp= new bitmapfile();
                            bmp->write("segment1.bmp",m->pixelbitmap,m->pixelbitmapHeight,m->pixelbitmapWidth);
                            ........

                            // encode second segment
                            m2->codeBinary=inputDataPart2; // data to be encoded , chunk 2
                            m2->PDFMacroSegmentCount=2; // number of segment
                            m2->PDFMacroSegment=1; // second segment
                            m2->PDFMacroLastSegment=true; // this is the last one
                            m2->PDFMacroFileId=fileId; // must be the same as for segment 1
                            .......

                            m2->paint(); // encode second segment

                            bmp->write("segment2.bmp",m2->pixelbitmap,m2->pixelbitmapHeight,m2->pixelbitmapWidth);


                          2. Let the component figure out the number of segments required.


                            m->codeBinary=inputData;
                            int* fileId=new int[4];
                            fileId[0]=1; // any value for the file id
                            fileId [1]=2;
                            fileId [2]=3;
                            fileId [3]=-1; // last element must be -1
                            m->PDFMacroFileId=fileId; // always set file id

                            m->resetMacroPDF();
                            m->prepareMacroPDF(); // after this call m->PDFMacroSegmentCount contains the number of segments required to encode the data

                            // paint all segments
                            bitmapfile* bmp2= new bitmapfile();

                            for (int i=0;i<m->PDFMacroSegmentCount;i++) {

                            m->PDFMacroSegment=i; // paint segments one by one
                            m->paint();
                            bmp2->write(filename,m->pixelbitmap,m->pixelbitmapHeight,m->pixelbitmapWidth);

                            }

                           

                          PDF Modes  
                          Mode
                          Value
                          Byte
                          0
                          Text
                          1
                          Numeric
                          2

                           

                          QRCode

                          QR Code is a matrix symbology which includes a finder pattern located at three corners of the symbol used to locate the symbol and figure out its size and orientation. The QRCode following features are supported

                          • AUTO, BYTE, ALPHA, NUMERIC and KANJI encoding. QR Code symbols can endode the following amount of data (for maximum symbol size - Version 40, error correction level L):
                            • numeric data: 7,089 characters
                            • alphanumeric data: 4,296 characters
                            • 8-bit byte data: 2,953 characters
                            • Kanji data: 1,817 characters
                          • Structured append. This allows files of data to be represented logically and continuously in up to 16 QR Code symbols. These may be scanned in any sequence to enable the original data to be correctly reconstructed.
                          • Versions 1 to 40. The version is the size of the symbol. Version 1 is a 21x21 matrix and version 40 is a 177x177 matrix.
                          • Error correction levels L, H, M and Q.
                          • FNC1 mode. FNC1 mode is used for messages containing data formatted either in accordance with the UCC/EAN Application Identifiers standard or in accordance with a specific industry standard previously agreed with AIM International.
                          • Extended channel interpretation: This mechanism enables data using character sets other than the default encodable .

                          J4L-QRCode supports:

                          • QRCode mode 2 symbols (not mode 1)
                          • All versions 1-40. Automatic selection of the version is also supported.
                          • All encoding method (numeric, alphanumeric, byte and kanji). Automatic selection of the encoding method is also supported.
                          • Structured append.
                          • Extended Channel Interpretation (only 1 per symbol, no nesting supported).
                          • All 4 error correction levels.
                          • FNC1 indicators

                           

                          Formats

                          Table — Data capacity for QRCode versions

                          Version
                          Error Correction Level

                          Numeric

                          Alphanumeric

                          Byte

                          Kanji

                          1

                          L
                          M
                          Q
                          H

                          41
                          34
                          27
                          17

                          25
                          20
                          16
                          10

                          17
                          14
                          11
                          7

                          10
                          8
                          7
                          4

                          2

                          L
                          M
                          Q
                          H

                          77
                          63
                          48
                          34

                          47
                          38
                          29
                          20

                          32
                          26
                          20
                          14

                          20
                          16
                          12
                          8

                          3

                          L
                          M
                          Q
                          H

                          127
                          101
                          77
                          58

                          77
                          61
                          47
                          35

                          53
                          42
                          32
                          24

                          32
                          26
                          20
                          15

                          4

                          L
                          M
                          Q
                          H

                          187
                          149
                          111
                          82

                          114
                          90
                          67
                          50

                          78
                          62
                          46
                          34

                          48
                          38
                          28
                          21

                          5

                          L
                          M
                          Q
                          H

                          255
                          202
                          144
                          106

                          154
                          122
                          87
                          64

                          106
                          84
                          60
                          44

                          65
                          52
                          37
                          27

                          6

                          L
                          M
                          Q
                          H

                          322
                          255
                          178
                          139

                          195
                          154
                          108
                          84

                          134
                          106
                          74
                          58

                          82
                          65
                          45
                          36

                          7

                          L
                          M
                          Q
                          H

                          370
                          293
                          207
                          154

                          224
                          178
                          125
                          93

                          154
                          122
                          86
                          64

                          95
                          75
                          53
                          39

                          8

                          L
                          M
                          Q
                          H

                          461
                          365
                          259
                          202

                          279
                          221
                          157
                          122

                          192
                          152
                          108
                          84

                          118
                          93
                          66
                          52

                          9

                          L
                          M
                          Q
                          H

                          552
                          432
                          312
                          235

                          335
                          262
                          189
                          143

                          230
                          180
                          130
                          98

                          141
                          111
                          80
                          60

                          10

                          L
                          M
                          Q
                          H

                          652
                          513
                          364
                          288

                          395
                          311
                          221
                          174

                          271
                          213
                          151
                          119

                          167
                          131
                          93
                          74

                          11

                          L
                          M
                          Q
                          H

                          772
                          604
                          427
                          331

                          468
                          366
                          259
                          200

                          321
                          251
                          177
                          137

                          198
                          155
                          109
                          85

                          12

                          L
                          M
                          Q
                          H

                          883
                          691
                          489
                          374

                          535
                          419
                          296
                          227

                          367
                          287
                          203
                          155

                          226
                          177
                          125
                          96

                          13

                          L
                          M
                          Q
                          H

                          1022
                          796
                          580
                          427

                          619
                          483
                          352
                          259

                          425
                          331
                          241
                          177

                          262
                          204
                          149
                          109

                          14

                          L
                          M
                          Q
                          H

                          1101
                          871
                          621
                          468

                          667
                          528
                          376
                          283

                          458
                          362
                          258
                          194

                          282
                          223
                          159
                          120

                          15

                          L
                          M
                          Q
                          H

                          1250
                          991
                          703
                          530

                          758
                          600
                          426
                          321

                          520
                          412
                          292
                          220

                          320
                          254
                          180
                          136

                          16

                          L
                          M
                          Q
                          H

                          1408
                          1082
                          775
                          602

                          854
                          656
                          470
                          365

                          586
                          450
                          322
                          250

                          361
                          277
                          198
                          154

                          17

                          L
                          M
                          Q
                          H

                          1548
                          1212
                          876
                          674

                          938
                          734
                          531
                          408

                          644
                          504
                          364
                          280

                          397
                          310
                          224
                          173

                          18

                          L
                          M
                          Q
                          H

                          1725
                          1346
                          948
                          746

                          1046
                          816
                          574
                          452

                          718
                          560
                          394
                          310

                          442
                          345
                          243
                          191

                          19

                          L
                          M
                          Q
                          H

                          1903
                          1500
                          1063
                          813

                          1153
                          909
                          644
                          493

                          792
                          624
                          442
                          338

                          488
                          384
                          272
                          208

                          20

                          L
                          M
                          Q
                          H

                          2061
                          1600
                          1159
                          919

                          1249
                          970
                          702
                          557

                          858
                          666
                          482
                          382

                          528
                          410
                          297
                          235

                          21

                          L
                          M
                          Q
                          H

                          2232
                          1708
                          1224
                          969

                          1352
                          1035
                          742
                          587

                          929
                          711
                          509
                          403

                          572
                          438
                          314
                          248

                          22

                          L
                          M
                          Q
                          H

                          2409
                          1872
                          1358
                          1056

                          1460
                          1134
                          823
                          640

                          1003
                          779
                          565
                          439

                          618
                          480
                          348
                          270

                          23

                          L
                          M
                          Q
                          H

                          2620
                          2059
                          1468
                          1108

                          1588
                          1248
                          890
                          672

                          1091
                          857
                          611
                          461

                          672
                          528
                          376
                          284

                          24

                          L
                          M
                          Q
                          H

                          2812
                          2188
                          1588
                          1228

                          1704
                          1326
                          963
                          744

                          1171
                          911
                          661
                          511

                          721
                          561
                          407
                          315

                          25

                          L
                          M
                          Q
                          H

                          3057
                          2395
                          1718
                          1286

                          1853
                          1451
                          1041
                          779

                          1273
                          997
                          715
                          535

                          784
                          614
                          440
                          330

                          26

                          L
                          M
                          Q
                          H

                          3283
                          2544
                          1804
                          1425

                          1990
                          1542
                          1094
                          864

                          1367
                          1059
                          751
                          593

                          842
                          652
                          462
                          365

                          27

                          L
                          M
                          Q
                          H

                          3517
                          2701
                          1933
                          1501

                          2132
                          1637
                          1172
                          910

                          1465
                          1125
                          805
                          625

                          902
                          692
                          496
                          385

                          28

                          L
                          M
                          Q
                          H

                          3669
                          2857
                          2085
                          1581

                          2223
                          1732
                          1263
                          958

                          1528
                          1190
                          868
                          658

                          940
                          732
                          534
                          405

                          29

                          L
                          M
                          Q
                          H

                          3909
                          3035
                          2181
                          1677

                          2369
                          1839
                          1322
                          1016

                          1628
                          1264
                          908
                          698

                          1002
                          778
                          559
                          430

                          30

                          L
                          M
                          Q
                          H

                          4158
                          3289
                          2358
                          1782

                          2520
                          1994
                          1429
                          1080

                          1732
                          1370
                          982
                          742

                          1066
                          843
                          604
                          457

                          31

                          L
                          M
                          Q
                          H

                          4417
                          3486
                          2473
                          1897

                          2677
                          2113
                          1499
                          1150

                          1840
                          1452
                          1030
                          790

                          1132
                          894
                          634
                          486

                          32

                          L
                          M
                          Q
                          H

                          4686
                          3693
                          2670
                          2022

                          2840
                          2238
                          1618
                          1226

                          1952
                          1538
                          1112
                          842

                          1201
                          947
                          684
                          518

                          33

                          L
                          M
                          Q
                          H

                          4965
                          3909
                          2805
                          2157

                          3009
                          2369
                          1700
                          1307

                          2068
                          1628
                          1168
                          898

                          1273
                          1002
                          719
                          553

                          34

                          L
                          M
                          Q
                          H

                          5253
                          4134
                          2949
                          2301

                          3183
                          2506
                          1787
                          1394

                          2188
                          1722
                          1228
                          958

                          1347
                          1060
                          756
                          590

                          35

                          L
                          M
                          Q
                          H

                          5529
                          4343
                          3081
                          2361

                          3351
                          2632
                          1867
                          1431

                          2303
                          1809
                          1283
                          983

                          1417
                          1113
                          790
                          605

                          36

                          L
                          M
                          Q
                          H

                          5836
                          4588
                          3244
                          2524

                          3537
                          2780
                          1966
                          1530

                          2431
                          1911
                          1351
                          1051

                          1496
                          1176
                          832
                          647

                          37

                          L
                          M
                          Q
                          H

                          6153
                          4775
                          3417
                          2625

                          3729
                          2894
                          2071
                          1591

                          2563
                          1989
                          1423
                          1093

                          1577
                          1224
                          876
                          673

                          38

                          L
                          M
                          Q
                          H

                          6479
                          5039
                          3599
                          2735

                          3927
                          3054
                          2181
                          1658

                          2699
                          2099
                          1499
                          1139

                          1661
                          1292
                          923
                          701

                          39

                          L
                          M
                          Q
                          H

                          6743
                          5313
                          3791
                          2927

                          4087
                          3220
                          2298
                          1774

                          2809
                          2213
                          1579
                          1219

                          1729
                          1362
                          972
                          750

                          40

                          L
                          M
                          Q
                          H

                          7089
                          5596
                          3993
                          3057

                          4296
                          3391
                          2420
                          1852

                          2953
                          2331
                          1663
                          1273

                          1817
                          1435
                          1024
                          784

                           

                          Encoding

                          The data represented in the symbol can be compressed using one or several of the following algorithms:

                          • ALPHA = 0: encodes alphanumeric characters (digits 0 - 9; upper case letters A -Z; nine other characters: space, $ % * + - . / : ); )
                          • BYTE: encodes binary values ( 8-bit data)
                          • NUMERIC: encodes numeric values only (digits 0-9)
                          • KANJI: encodes Kanji characters. Kanji characters in QR Code can have values 8140 -9FFC and E040 - EBBF

                           

                          Control characters

                          J4L-QRCode uses the character ~ (tilde) to recognize some special characters in the input data:

                          • ~dNNN represents the ascii character encoded by the 3 digits NNN. For exmaple, ~d065 represents the character 'A'.

                          Test application

                          The product includes a small demo application which creates BMP files. The program is called datamatrix.exe and supports the following options

                          • -file: output bmp file
                          • -encoding: (see table below)
                          • -format: (see table below)
                          • -code: value to encode
                          • -level: error correction level (see table below)
                          • -tilde: process tilde (1 for true, 0 for false)
                          • -dataFile: input file which contains the value to encode

                          example:

                          qrcode.exe -file qrcode.bmp -encoding 4 -format 0 -level 0 -code 1234567890

                          will encode the value 1234567890 using AUTO encoding.

                           

                          DLL

                           

                          The DLL file datamatrix.dll has one entry point defined as:

                          void createQRCode(char format,char encoding,char level,unsigned short int dataLen,char* data,char* file);

                          where:

                          • format: see table in the formats section. The format is the number of the QRCode version minus 1.
                          • encoding: see table below
                          • level: see table below
                          • dataLen: length of data to be encoded
                          • data: pointer to the data to be encoded
                          • file: name of the BMP file to be created

                           

                          The following Visual Basic 6.0 code shows how to call the DLL :

                          Private Declare Sub createQRCode Lib "qrcode.dll" (ByVal format As Byte, ByVal encoding As Byte, ByVal level as Byte, ByVal datalen As Integer, FirstDataElement As Byte, name As Byte)

                          .......

                          Dim data(100) As Byte
                          Dim file(100) As Byte
                          Dim format As Byte
                          Dim encoding As Byte
                          Dim level as Byte

                          Dim dataLen As Byte
                          Dim h As Integer

                          file(0) = Asc("c")
                          file(1) = Asc(":")
                          file(2) = Asc("\")
                          file(3) = Asc("a")
                          file(4) = Asc(".")
                          file(5) = Asc("b")
                          file(6) = Asc("m")
                          file(7) = Asc("p")
                          file(8) = 0

                          dataLen = 100 ' encode 100 A
                          For h = 0 To i - dataLen
                          data(h) = Asc("A")
                          Next

                          format = 1
                          level=0
                          encoding= 4' AUTO

                          createQRCode format, encoding, level, dataLen, data(0), file(0)

                           

                          C++ source code

                           

                          If you want to compile the source code together with your C++ application you can use the following code for creating a bmp file:

                          string filename="c:\\qrcode.bmp";

                          QRCode* m= new QRCode();

                          m->setBinaryCode(data,dataLen); // where data is int*
                          m->encoding=encoding; // 4, AUTO, 3 Kanji, 2 numeric, 1 byte, 0 alpha
                          m->correctionLevel=level; // 0-L , 1-M, 2-Q , 3-H
                          m->preferredVersion=format; // 0 till 39
                          m->processTilde=false;


                          /* m->setFnc1Mode(2);

                          //strcutured append configuration

                          m->setStructuredAppend(true);
                          m->setStructuredAppendCounter(2);
                          m->setStructuredAppendIndex(1);*/

                          m->paint();

                          // create now bmp file

                          bitmapfile* bmp= new bitmapfile();
                          bmp->write(filename,m->bitmap,m->rows,m->cols);

                          delete bmp;
                          delete m;

                          if you want to read the datamatrix bitmap array instead of create a bmp file you must use:

                          m->getBitmapEntry(col,row);

                          where:

                          • 0<= col < m->cols
                          • 0<= row < m->rows

                           

                          QRCode  
                          Encoding
                          Value
                          APLHA
                          0
                          BYTE
                          1
                          BINARY
                          2
                          KANJI
                          3
                          AUTO
                          4

                           

                          QRCode  
                          Error Correction Level
                          Value
                          L (7%)
                          0
                          M (15%)
                          1
                          Q (25%)
                          2
                          H (30%)
                          3

                           

                           

                          Aztec code

                           

                           

                          Aztec Code is a 2D matrix symbology made up of square modules on a square grid, with a square bullseye pattern at their center. Aztec Code symbols can encode large amounts of data with user defined error correction level.

                          The smallest format can encode 13 numeric , 12 alphabetic characters or 6 bytes of data, while the largest format can encode 3832 numeric ,3067 alphabetic characters or 1914 bytes of data.

                          Compact formats can be used to encode short messages in a more efficient manner than full range formats. Note that reader/decoder can autodiscrimanate between both formats.

                          There are also a set of 256 special formats called "Aztec runes" which can be used for encoding values 0 to 255 for special applications.

                           

                          RAztecCode supports:

                          • All Aztec code formats (compact and full range).
                          • Normal and binary encoding.
                          • Structured append. This allows you to encode large messages by means of a secuence of symbols.
                          • Extended Channel Interpretation.
                          • Reader initialization bit.
                          • Aztec Runes.

                          Formats

                          Available formats are:

                           

                          Rows / columns (number of modules/squares)
                          Capacity (digits)
                          Capacity (text)
                          Capacity (binary data)
                          CONFIGURATION_15X15_COMPACT
                          13
                          12
                          6
                          CONFIGURATION_19X19
                          18
                          15
                          8
                          CONFIGURATION_19X19_COMPACT
                          40
                          33
                          19
                          CONFIGURATION_23X23
                          49
                          40
                          24
                          CONFIGURATION_23X23_COMPACT
                          70
                          57
                          33
                          CONFIGURATION_27X27
                          84
                          68
                          40
                          CONFIGURATION_27X27_COMPACT
                          110
                          89
                          53
                          CONFIGURATION_31X31
                          128
                          104
                          62
                          CONFIGURATION_37X37
                          178
                          144
                          87
                          CONFIGURATION_41X41
                          232
                          187
                          114
                          CONFIGURATION_45X45
                          294
                          236
                          145
                          CONFIGURATION_49X49
                          362
                          291
                          179
                          CONFIGURATION_53X53
                          433
                          348
                          214
                          CONFIGURATION_57X57
                          516
                          414
                          256
                          CONFIGURATION_61X61
                          601
                          482
                          298
                          CONFIGURATION_67X67
                          691
                          554
                          343
                          CONFIGURATION_71X71
                          793
                          636
                          394
                          CONFIGURATION_75X75
                          896
                          896
                          446
                          CONFIGURATION_79X79
                          1008
                          808
                          502
                          CONFIGURATION_83X83
                          1123
                          900
                          559
                          CONFIGURATION_87X87
                          1246
                          998
                          621
                          CONFIGURATION_91X91
                          1378
                          1104
                          687
                          CONFIGURATION_95X95
                          1511
                          1210
                          753
                          CONFIGURATION_101X101
                          1653
                          1324
                          824
                          CONFIGURATION_105X105
                          1801
                          1442
                          898
                          CONFIGURATION_109X109
                          1956
                          1566
                          976
                          CONFIGURATION_113X113
                          2216
                          1694
                          1056
                          CONFIGURATION_117X117
                          2281
                          1826
                          1138
                          CONFIGURATION_121X121
                          2452
                          1963
                          1224
                          CONFIGURATION_125X125
                          2632
                          2107
                          1314
                          CONFIGURATION_131X131
                          2818
                          2256
                          1407
                          CONFIGURATION_135X135
                          3007
                          2407
                          1501
                          CONFIGURATION_139X139
                          3205
                          2565
                          1600
                          CONFIGURATION_143X143
                          3409
                          2728
                          1702
                          CONFIGURATION_147X147
                          3616
                          2894
                          1806
                          CONFIGURATION_151X151
                          3832
                          3067
                          1914

                           

                          Encoding

                          The data represented in the symbol can be compressed using one of the following algorithms:

                          • NORMAL: can encode any character but it is not very efficient encoding binary values (values above 128).
                          • BINARY: use this mode only if your data contains many bytes/characters above 128.

                          Control characters

                          J4L-Aztec uses the character ~ to recognize some special characters in the input data (if the processTilde option has been activated). The following possibilities are available:

                          • ~~: will be replaced with ~
                          • ~dxxx: will be replaced by the character whose ascii code is xxx. For example ~d065 will be replaced with A.
                          • ~F: will be replaced with the FNC1 flag (allowed as first codeword only).
                          • ~Exxxxxx: will be replaced with the Extended Interpretation Channel flag xxxxxx. For example to activate Extended Interpretation Channel 1, use ~E000001.

                          Test application

                          The product includes a small demo application which creates BMP files. The program is called aztec.exe and supports the following options

                          • -file: output bmp file
                          • -encoding: (see table below)
                          • -format: see table in the formats section. The smallest configuration has the value 0 and the largest 35.
                          • -code: value to encode
                          • -level: error correction level, default is 23, (23%) .
                          • -tilde: process tilde (1 for true, 0 for false)
                          • -dataFile: input file which contains the value to encode

                          example:

                          aztec.exe -file aztec.bmp -encoding 0 -format 0 -level 23 -code 1234567890

                          will encode the value 1234567890 using NORMAL encoding.

                           

                          DLL

                           

                          The DLL file aztec.dll has one entry point defined as:

                          void createAztec(char format,char encoding, char level ,unsigned short int dataLen,char* data,char* file);

                          where:

                          • format: see table in the formats section. The smallest configuration has the value 0 and the largest 35.
                          • encoding: see table below
                          • level: error correction level, default is 23, (23%) .
                          • dataLen: length of data to be encoded
                          • data: pointer to the data to be encoded
                          • file: name of the BMP file to be created

                           

                          The following Visual Basic 6.0 code shows how to call the DLL :

                           

                          Private Declare Sub createAztec Lib "aztec.dll" (ByVal format As Byte, ByVal encoding As Byte, ByVal level as Byte, ByVal datalen As Integer, FirstDataElement As Byte, name As Byte)

                          .......

                          Dim data(100) As Byte
                          Dim file(100) As Byte
                          Dim format As Byte
                          Dim encoding As Byte
                          Dim level as Byte

                          Dim dataLen As Byte
                          Dim h As Integer

                          file(0) = Asc("c")
                          file(1) = Asc(":")
                          file(2) = Asc("\")
                          file(3) = Asc("a")
                          file(4) = Asc(".")
                          file(5) = Asc("b")
                          file(6) = Asc("m")
                          file(7) = Asc("p")
                          file(8) = 0

                          dataLen = 100 ' encode 100 A
                          For h = 0 To dataLen- 1
                          data(h) = Asc("A")
                          Next

                          format = 0
                          level=23
                          encoding= 0

                          createAztec format, encoding, level, dataLen, data(0), file(0)


                           

                          C++ source code

                           

                          If you want to compile the source code together with your C++ application you can use the following code for creating a bmp file:

                          string filename="c:\\aztec.bmp";

                          Aztec* m= new Aztec();

                          m->setBinaryCode(d,dataLen);
                          m->setEncoding(1); // 0 normal , 1 binary
                          m->setPreferredConfiguration(0);
                          m->setAutoConfigurate(true);
                          m->setConfigurationType(0); // 0 any, 1 compact, 2 full
                          m->setProcessTilde(false);

                          // configuration for structured append
                          /*m->setStructuredAppend(true);
                          m->setStructuredAppendCounter(2);
                          m->setStructuredAppendIndex(1);
                          m->setFileId("ABC");*/

                          m->paint();

                          // create now bmp file

                          bitmapfile* bmp= new bitmapfile();
                          bmp->write(filename,m->bitmap,m->rows,m->cols);

                          delete bmp;
                          delete m;

                          if you want to read the datamatrix bitmap array instead of create a bmp file you must use:

                          m->getBitmapEntry(col,row);

                          where:

                          • 0<= col < m->cols
                          • 0<= row < m->rows

                           

                          Aztec  
                          Encoding
                          Value
                          NORMAL
                          0
                          BINARY
                          1