The package J4L-QRCode contains the classes you need to create QRCode barcodes within your jsp or java applications.
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 main features of QRCode symbols are:
J4L-QRCode supports:
In order to install the software you just need to unzip the ZIP file in an empty directory (your must unzip with pathname so that the subdirectories are properly created.
In order to run the sample application you must execute runSUN.bat. The sample application requires JDK 1.3 or later. However the component will also work with JDK 1.1 or 1.2. Let us know if you need a test version for java 1.1 or 1.2.
In the sample application you can set all properties of the QRCode symbology.
You can execute the following commands:
- Apply: repaint the symbol using the new properties.
- Print: send image to printer at the selected resolution.
- Save: save the symbol in jpg format. We recommend you to use gif or png formats,however the sample application uses JPG because it does not require you to download any additional package. In order to create gif or png files you must download an external encoder (see javadoc).
- Exit: terminate application.
QRCode comes with a standard servlet (QRCodeServlet) you can use to create qrcode images. The parameters for the servlet can be sent using GET or POST commands. The parameters are:
For example, if you want to test the servlet using Tomcat 4.1 you must do the following:
http://localhost:8080/examples/servlet/QRCodeServlet?DATA=ABC&ENCODING=NORMAL
In order to property print a barcode created with the servlet you must use the <IMG> tag. In this way you can embed the image in your HTML page. Note that you will need to use the attibutes height and width in order to achieve the correct size of the barcode on the printed page.
This is a simple HTML page that contains a qrcode symbol:
<HTML>
<HEAD><TITLE>Servlet Example META http-equiv=Content-Type content="text/html; charset=windows-1252">
</HEAD>
<BODY bgColor=#ffffff>This is your Barcode:
<IMG height=100 width=100 src="http://localhost:8080/examples/servlet/QRCodeServlet?DATA=TEST" ></BODY>
</HTML>
You must add the following code in your html pages to use the applet:
<APPLET
CODEBASE = "./"
CODE = "com.java4less.qrcode.QRCodeApplet.class"
ARCHIVE = "qrcode.jar"
NAME = "TestApplet"
WIDTH = 300
HEIGHT = 250
HSPACE = 0
VSPACE = 0
ALIGN = middle
><PARAM NAME = "DATA" VALUE = "123411">
</APPLET>
Note that the qrcode.jar file must be located in the directory referenced by the CODEBASE parameter.
The available paramete are the same as those used by the servlet (see description in the previous section):
Table — Data capacity for QRCode versions
Version
|
Error
Correction Level
|
Numeric |
Alphanumeric |
Byte |
Kanji |
|
1 |
L |
41 |
25 |
17 |
10 |
|
2 |
L |
77 |
47 |
32 |
20 |
|
3 |
L |
127 |
77 |
53 |
32 |
|
4 |
L |
187 |
114 |
78 |
48 |
|
5 |
L |
255 |
154 |
106 |
65 |
|
6 |
L |
322 |
195 |
134 |
82 |
|
7 |
L |
370 |
224 |
154 |
95 |
|
8 |
L |
461 |
279 |
192 |
118 |
|
9 |
L |
552 |
335 |
230 |
141 |
|
10 |
L |
652 |
395 |
271 |
167 |
|
11 |
L |
772 |
468 |
321 |
198 |
|
12 |
L |
883 |
535 |
367 |
226 |
|
13 |
L |
1022 |
619 |
425 |
262 |
|
14 |
L |
1101 |
667 |
458 |
282 |
|
15 |
L |
1250 |
758 |
520 |
320 |
|
16 |
L |
1408 |
854 |
586 |
361 |
|
17 |
L |
1548 |
938 |
644 |
397 |
|
18 |
L |
1725 |
1046 |
718 |
442 |
|
19 |
L |
1903 |
1153 |
792 |
488 |
|
20 |
L |
2061 |
1249 |
858 |
528 |
|
21 |
L |
2232 |
1352 |
929 |
572 |
|
22 |
L |
2409 |
1460 |
1003 |
618 |
|
23 |
L |
2620 |
1588 |
1091 |
672 |
|
24 |
L |
2812 |
1704 |
1171 |
721 |
|
25 |
L |
3057 |
1853 |
1273 |
784 |
|
26 |
L |
3283 |
1990 |
1367 |
842 |
|
27 |
L |
3517 |
2132 |
1465 |
902 |
|
28 |
L |
3669 |
2223 |
1528 |
940 |
|
29 |
L |
3909 |
2369 |
1628 |
1002 |
|
30 |
L |
4158 |
2520 |
1732 |
1066 |
|
31 |
L |
4417 |
2677 |
1840 |
1132 |
|
32 |
L |
4686 |
2840 |
1952 |
1201 |
|
33 |
L |
4965 |
3009 |
2068 |
1273 |
|
34 |
L |
5253 |
3183 |
2188 |
1347 |
|
35 |
L |
5529 |
3351 |
2303 |
1417 |
|
36 |
L |
5836 |
3537 |
2431 |
1496 |
|
37 |
L |
6153 |
3729 |
2563 |
1577 |
|
38 |
L |
6479 |
3927 |
2699 |
1661 |
|
39 |
L |
6743 |
4087 |
2809 |
1729 |
|
40 |
L |
7089 |
4296 |
2953 |
1817 |