J4L-QRCode for the Java[TM] platform

Copyright J4L Components (http://www.java4less.com) 2005.

Introduction

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:

Installation and requirements

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.

 

Examples

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:

 

The Servlet

 

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:

  1. copy the qrcode.jar to /tomcat/webapps/examples/Web-inf/lib
  2. Start the server and test the servlet entering the following address and parameters in your browser:

    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>

The Applet

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):

 

Annex A

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