Home Page J4L Barcodes for Realbasic & XOJO
Home
J4L Barcodes for Realbasic & XOJO
Introduction
User guide
Download
Pricing & Purchase
License
Reading barcodes

For other languages
.NET
ActiveX
AJAX/Javascript
C++
Delphi
Java
PHP
XOJO & Realbasic
Ruby

Related products
RBarcode Vision
User guide
RBarcode

J4L-Barcode for Real Studio and Realbasic (XOJO)

Copyright J4L (http://www.java4less.com) 2011
  • Introduction
  • Barcode 1D
    • Introduction
    • Installation
    • Methods and properties of the class
    • Custom control
  • Datamatrix
    • Introduction
    • Installation
    • Methods and properties of the class
    • Custom control
  • QRCode
    • Introduction
    • Installation
    • Methods and properties of the class
    • Custom control
    • QRCode capacity table
  • PDF 417 and Macro PDF 417
    • Introduction
    • Installation
    • Methods and properties of the class
    • Custom control
  • Aztec code
    • Introduction
    • Installation
    • Methods and properties of the class
    • Custom control
  • Questions?

 

Introduction

Real Studio (also known as Realbasic) is a cross platform development tool for Mac OS X , Linux, Windows and the web. The programming language is very similar to the well known Microsoft Visual Basic. J4LBarcode for Real Studio is a set of native Realbasic classes that you can import in your project and compile together with your application.

 

Barcode 1D

 

Introduction

The RealbasicJ4LBarcode1D class implements the following one dimensional barcoding symbologies:

  • Code 39 ( and extended)
  • Code 93 (and extended)
  • Code 128
  • EAN 128
  • EAN 8
  • EAN 13
  • UPCA and UPCE
  • MSI
  • CODABAR
  • Postnet
  • Interleaved 2 of 5
  • Code 11
  • Industrial 2 of 5
  • Matrix 2 of 5

The class can be used as a control in a deskop application or as an standalone class that creates images, for example for the web.

 

Installation

The class can be used in your project by selecting File->import or File->import as external in Real Studio. The files to be imported are:

  • J4LBarcode1D.rbo
  • and optionally J4LBarcode1DCanvas.rbo. 



Once that has been done a new instance of the class can be created:

Dim myBarcode as J4LBarcode1D

myBarcode= new J4LBarcode1D

 

Methods and properties of the Realbasic Class

The J4LBarcode1D class has the following properties:

  • barType: this is the type of barcode to be used. Valid values are: 
    • J4LBarcode1D.tBarType.BAR39
    • J4LBarcode1D.tBarType.BAR39EXT
    • J4LBarcode1D.tBarType.CODE11
    • J4LBarcode1D.tBarType.CODABAR
    • J4LBarcode1D.tBarType.CODE93EXT
    • J4LBarcode1D.tBarType.CODE128
    • J4LBarcode1D.tBarType.MSI
    • J4LBarcode1D.tBarType.IND25
    • J4LBarcode1D.tBarType.MAT25
    • J4LBarcode1D.tBarType.INTERLEAVED25
    • J4LBarcode1D.tBarType.EAN13
    • J4LBarcode1D.tBarType.EAN8
    • J4LBarcode1D.tBarType.EAN128
    • J4LBarcode1D.tBarType.POSTNET
    • J4LBarcode1D.tBarType.UPCA
    • J4LBarcode1D.tBarType.UPCE
  • barbackColor: back color of the barcode. The default value is &cFFFFFF  (white).
  • barForeColor: color of the bars. The default value is &c000000  (black).
  • barHeight:: height of the bars in pixels. If this value is 0, it will be calculated using H.
  • CODABARStartChar: Start character for CODABAR. Valid values are "A", "B", "C" or "D".
  • CODABARStopChar: Stop character for CODABAR. Valid values are "A", "B", "C" or "D".
  • code: this is the value to be encoded.
  • barcode128set: set of charaters to be used in code128. Valid values are : J4LBarcode1D.tCode128Type.code128A, J4LBarcode1D.tCode128Type.code128B and J4LBarcode1D.tCode128Type.code128C.
  • checkCharacter : If true the software will calculate the check character automatically. The default is true.
  • barFontColor: color of the font used to display the code. The default value is &c000000  (black).
  • guardBars: indicates if guardbars will be heighe than other bars. Only for EAN and UPC.
  • I: intercharacter separator , only for BAR39. A value of 1 means that the separator will have the same length as X.
  • H: Indicates how to calculate the height of the bars. A value of 0.5 means that the bars should be half the length of the symbol.
  • leftMargin: left margin in pixels.
  • N: a value of 2, means that wide bars will be 2 times the width of narrow bars. The default vaue is 2.
  • postnetHeightTallBar: height (in pixels) of PostNet's tall bar.
  • postnetHeightShortBar: height (in pixels) of PostNet's short bar.
  • supHeight: relative height of the supplement's bars (only EAN and UPC). The default (0.8) means 80% of the normal bars.
  • supSeparation: separation between the code and the supplement (in pixels). the default is 10(only EAN and UPC).
  • barFontName: font used to display the code. The default name is "System".
  • barFontSize: font used to display the code. The default value is 12.
  • topMargin: top margin in pixels.
  • textOnTop: set it to true to paint the barcode above the barcode.
  • UPCEANSupplement2: indicates if the codes EAN and UPC will have a 2 digit's supplement.
  • UPCEANSupplement5: indicates if the codes EAN and UPC will have a 5 digit's supplement.
  • UPCESystem: encoding system to be used for UPCE, valid values are J4LBarcode1D.tUPCESystem.cSystem0 and J4LBarcode1D.tUPCESystem.cSystem1.
  • X: width in pixels of narrow bars. The default is 1.

the available methods are:

  • saveToFile(filename as string, format as string): saves the barcode to a file, the format parameter can be PNG, BMP , GIF , EMF , TIFF or PICT. Note however not all formats are supported in all platforms (see Realbasic documentation).
  • paintBarcode(g as Graphics): paint the barcode on a graphics object.
  • paintedHeight(): returns size of the barcode on the image.
  • paintedWidth(): returns size of the barcode on the image.

 

Custom control

The class J4LBarcode1DCanvas is a custom control that is an extension of the Canvas control. Once this file has been imported in your project, this control can be used as any other control, it can be found in the project control list:

The barcode property of the control can be used to access the underlying J4LBarcode1D class. In the following screenshot you can see the properties of the control (they have the same names as the underlying J4LBarcode1D class).

 

Datamatrix

 

Introduction

The product is a Realbasic class that will allow you to create data matrix (ECC200) barcodes.

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.

J4LDataMatrix 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

J4LDataMatrix 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 is 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

J4L-DataMatrix 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 thie 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 byte 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 are 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'.

 

Installation

The class can be used in your project by selecting File->import or File->import as external in Real Studio. The files to be imported are:

  • J4LDatamatrix.rbo
  • and optionally J4LDatamatrixCanvas.rbo. 



Once that has been done a new instance of the class can be created:

Dim myBarcode as J4LDatamatrix

myBarcode= new J4LDatamatrix

 

Methods and properties of the Realbasic Class

The J4LDatamatrix class has the following properties:

  • applyTilde: set it to true to process the ~ character as described above. If not it will be treated as a normal character.
  • barcode: text to encode.
  • backBackColor: background color. The default value is black.
  • barForeColor: color of the bars. The default value is white.
  • barLeftMargin. Self explaining. The default is 30 pixels.
  • barTopMargin. Self explaining. The default is 30 pixels.
  • dotPixels: size of the square modules in pixels (the default is 4 pixels).
  • encoding: the encoding to be used. The default is tEncoding.E_ASCII. Posible values are tEncoding.E_ASCII, tEncoding.E_C40, tEncoding.E_EXT, tEncoding.E_BASE 256 and tEncoding.E_AUTO
  • preferredFormat: If equals tDSize.AUTO the format will be selected automatically, if not you can specify the format (e.g. tDSize.C24X24).
  • height and  width: size of the image holding the barcode.

the available methods are:

  • saveToFile(filename as string, format as string): saves the barcode to a file, the format parameter can be PNG, BMP , GIF , EMF , TIFF or PICT. Note however not all formats are supported in all platforms (see Realbasic documentation).
  • createBarcodeBitmap() as integer(,): create the barcode and return as an array of bitmaps, where a value different from 0 means a black module in the barcode.
  • paintBarcode(g as Graphics): paint the barcode on a graphics object.
  • paintedHeight(): returns size of the barcode on the image.
  • paintedWidth(): returns size of the barcode on the image.

 

Custom control

The class J4LDatamatrixCanvas is a custom control that is an extension of the Canvas control. Once this file has been imported in your project, this control can be used as any other control, it can be found in the project control list:

The datamatrix property of the control can be used to access the underlying J4LDatamatrix class. In the following screenshot you can see the properties of the control (they have the same names as the underlying J4LDatamatrix class).

 

QRCode

Introduction

The package J4L-QRCode contains the classes you need to create QRCode barcodes within your Realbasic 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:

  • There are 40 sizes of QR Code symbols (called Version 1, Version 2 till Version 40). Version 1 measures 21 modules * 21 modules, Version 2 measures 25 modules * 25 modules and so on. Version 40 measures 177 modules * 177 modules.
  • The following data can be encoded:
    • Numeric data (digits 0-9).
    • Alphanumeric characters , digits 0 - 9; upper case letters A -Z and nine other characters: space, $ % * + - . / :
    • Byte data (bytes 0-255)
    • Kanji characters ( hexadecimal values 8140 -9FFC and E040 - EBBF )
  • Symbol size is 21 * 21 modules to 177 * 177 modules (Versions 1 to 40, increasing in steps of 4 modules per side).
  • The maximum number of characters encoded in one symbol (without structured append) is:
    • Numeric data: 7089 characters
    • Alphanumeric data: 4296 characters
    • Byte data: 2953 characters
    • Kanji data: 1817 characters
  • Supports 4 error correction levels:
    • L ( 7% of the symbol codewords).
    • M ( 15% of the symbol codewords).
    • Q ( 25% of the symbol codewords).
    • H ( 30% of the symbol codewords).
  • Structured append (optional) This allows files of data to be represented logically in up to 16 QR Code symbols.
  • Extended Channel Interpretation (optional): enables data using character sets other than the default set (e.g. Arabic, Cyrillic, Greek).
  • FNC1 indicators: 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.

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.

 

Installation

The class can be used in your project by selecting File->import or File->import as external in Real Studio. The files to be imported are:

  • J4LQRCode.rbo, J4LBitmapQR, BitstringQR, ReedQR
  • and optionally J4LQRCodeCanvas.rbo. 

Once that has been done a new instance of the class can be created:

Dim myBarcode as J4LQRCode

myBarcode= new J4LQRCode

 

Parameters and properties of the Realbasic Class

The J4LDatamatrix class has the following properties:

  • applicationIndicator: see Fnc1Mode property.
  • AutoConfigurate: if true the preferredVersion property can be ignored if the data does not fit in the selected version.
  • barForeColor: color of the bars, the default value is black. You can also use the RGB numeric value of a color as parameter. For example &FF0000 is red (RGB format), &00FF00 is green and so on.
  • barBackColor: color of the background, the default value is white.
  • encoding: encoding mode (default is tEncoding.ENC_AUTO). Valid values are:
    • tEncoding.ENC_AUTO: Automatic selecting of the encoding method.
    • tEncoding.ENC_ALPHA: encode alpahnumeric characters only (upper case letter plus 9 additional characters).
    • tEncoding.ENC_NUMERIC: encode alpahnumeric digits only.
    • tEncoding.ENC_BYTE: use this mode to encode binary data.
    • tEncoding.ENC_KANJI: encodes Kanji characters only.
  • fnc1Mode: Selects FNC1 mode. Valid values are:
    • tEncoding.ENC_FNC1_MODE_NO: disable FNC1 (default).
    • tEncoding.ENC_FNC1_MODE_FIRST: This Mode Indicator identifies symbols encoding data formatted according to the UCC/EAN Application Identifiers standard.
    • tEncoding.ENC_FNC1_MODE_SECOND: This Mode Indicator identifies symbols formatted in accordance with specific industry or application specifications previously agreed with AIM International. You must then set a value for the ApplicationIndicator property.
  • processTilde: if true the tilde character (~) will be processed like this:
    • ~~: will be replaced with ~
    • ~dxxx: will be replaced by the character whose ascii code is xxx. For example ~d065 will be replaced with A.
  • code: string to be encoded.
  • codeBinary() as integer(): use the property to encode binary or Kanji data, see also useBinary property.
  • useBinary: set this property to true to encode the codeBinary value.
  • marginPixels: left and top margin in pixels (default is 30).
  • moduleWidth: number of pixels which make a module (square) in the barcode (default is 4).
  • structuredAppend: if true, the structured append mode is enabled (default is false).
  • structuredAppendCounter: number of symbols which make the sequence.
  • structuredAppendIndex: position of current symbol within the secuence (starting at 1).
  • PreferredVersion: preferred format (version). Another version will be automatically selected if AutoConfigurate=true and the amount of data and the selected error correction level does not fit in the preferred version. Valid values are 1 to 40.
  • selectedVersion: (read only property). You can read the selected version , in case you use autoConfigurate=true, after the barcode has been painted.
  • height and  width: size of the image holding the barcode.

 

the available methods are:

  • saveToFile(filename as string, format as string): saves the barcode to a file, the format parameter can be PNG, BMP , GIF , EMF , TIFF or PICT. Note however not all formats are supported in all platforms (see Realbasic documentation).
  • createBarcodeBitmap() as integer(,): create the barcode and return as an array of bitmaps, where a value different from 0 means a black module in the barcode.
  • paintBarcode(g as Graphics): paint the barcode on a graphics object.
  • paintedHeight(): returns size of the barcode on the image.
  • paintedWidth(): returns size of the barcode on the image.

 

Custom control

The class J4LQRCodeCanvas is a custom control that is an extension of the Canvas control. Once this file has been imported in your project, this control can be used as any other control, it can be found in the project control list:

The qrcode  property of the control can be used to access the underlying J4LQRCode class. In the following screenshot you can see the properties of the control (they have the same names as the underlying J4LQRCode class).

 

 

QRCode capacity table

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

 

PDF417 and Macro PDF417

 

Introduction

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...

The basic characteristics are:

  • Each PDF417 symbol consists of a stack of vertically aligned rows with a minimum of 3 rows (maximum 90 rows). Each row can have 1 to 30 columns.
  • Three compaction modes:
    • Text Compaction mode allows all printable ASCII characters to be encoded (i.e. values 32 to126 and some additional control characters)
    • Byte Compaction mode allows any byte values to be encoded.
    • Numeric Compaction is a more efficient mode for encoding numeric data
  • The maximum capacity is (at error correction level 0):
    • Text Compaction mode: 1 850 characters
    • Byte Compaction mode: 1 108 characters
    • Numeric Compaction mode: 2 710 characters
  • Macro PDF417: this feature allows large amount of data to be encoded in a secuence of linked PDF417 symbols. Up to 99 999 different PDF417 symbols can be concatenated using this mechanism.

 

Installation

The class can be used in your project by selecting File->import or File->import as external in Real Studio. The files to be imported are:

  • J4LPDF417.rbo
  • and optionally J4LPDF417Canvas.rbo. 



Once that has been done a new instance of the class can be created:

Dim myBarcode as J4LPDF417

myBarcode= new J4LPDF417

 

Methods and properties of the Realbasic Class

 

The PDF417 class has the following properties and methods:

Methods

  • paintBarCode(Graphics): paints the barcode on the provided graphics object. You can use the component in order to paint onto any graphic context. 
  • saveToFile(filename as string, format as string): saves the barcode to a file, the format parameter can be PNG, BMP , GIF , EMF , TIFF or PICT. Note however not all formats are supported in all platforms (see Realbasic documentation).
  • resetMacroPDF(): call this method before rendering a new Macro PDF barcode.
  • prepareMacroPDF(): call this method after resetMacroPDF(). After this method is executed you can read the number of segments required to encode your data. The number of symbols can be read from the pfdMadroSegmenCount Property. For example:

    pdf.resetMacroPDF()
    pdf.code="this is the value to encode"
    pdf.prepareMacroPDF()

    ' paint all MACRO PDF segments
    for i=0 to pdf.MacroSegmentCount-1 
    pdf.pdfSegment:=i
    'paint barcode now
    pdf.paintBarcode(graphics)
    next

 

Properties

  • barForeColor: color of the bars, the default value is black. You can also use the RGB numeric value of a color as parameter. For example &FF0000 is red (RGB format), &00FF00 is green and so on.
  • barBackColor: color of the background, the default value is white.
  • barHeight: height in pixels of the bars (default is 7).
  • barWidth: width in pixels of the bars (default is 1).
  • code: string to be encoded.
  • codeBinary() as integer(): use the property to encode binary instead of a string.
  • leftMargin: left margin in pixels (default is 10).
  • topMargin: top margin in pixels (default is 10).
  • PDFColumns: number of columns of the PDF417 symbol (default is 10)
  • PDFRows: number of rows of the PDF417 symbol (default is 0). If 0 the number is automatically calulated.
  • PDFMaxRows: maximum number of rows of the PDF417 symbol (optional).
  • PDFECLevel: Error correction level (default is 0). Valid values are 0, 1, 2, 3, 4 and 5.
  • PDFMode: encoding mode (default is tMode.PDF_BINARY). Valid values are:
    • tMode.PDF_BINARY: can encode any character.
    • tMode.PDF_TEXT: can encode alphanumeric characters and the following punctuation characters: ! \ # $ % & ' ( ) * + , - . / { } | ~
    • tMode.PDF_NUMERIC: encodes digits characters only.
  • height and  width: size of the image holding the barcode, the default size is 200x200.
 

Macro PDF properties

  • PDFMacroSegmentCount (read only): number of segments in the macro PDF. This value is calculated by prepareMacroPDF().
  • PDFMacroSegment: Segment of the Macro PDF. Can be a value between 0 and SegmentCount-1.
  • PDFMacroFileName: filename for Macro PDF control block (optional)
  • PDFMacroFileID: file id for Macro PDF control block (optional)
  • PDFMacroFileSize: file size for Macro PDF control block (optional)
  • PDFMacroTimestamp: timestamp for Macro PDF control block (optional)
  • PDFMacroSender: sender for Macro PDF control block (optional)
  • PDFMacroAddresse: addresse for Macro PDF control block (optional)

 

Custom control

The class J4LPDF417Canvas is a custom control that is an extension of the Canvas control. Once this file has been imported in your project, this control can be used as any other control, it can be found in the project control list:

The pdf417  property of the control can be used to access the underlying J4LPDF417 class. In the following screenshot you can see the properties of the control (they have the same names as the underlying J4LPDF417 class).

 

 

 

Aztec code

 

Introduction

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.

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

 

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.

 

J4L Aztec Code for Realbasic 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.

 

Installation

The class can be used in your project by selecting File->import or File->import as external in Real Studio. The files to be imported are:

  • J4LAztec.rbo
  • J4LAzBitmap.rbo
  • J4LAzBitstring.rbo
  • J4LAzUtil.rbo
  • and optionally J4LAztecCanvas.rbo. 



Once that has been done a new instance of the class can be created:

Dim myBarcode as J4LAztec

myBarcode= new J4LAztec

 

Methods and properties of the Realbasic Class


The J4LAztec class:

Methods

  • paintBarcode(graphics): paints the barcode on the provided graphics object.

     

  • saveToFile(filename as string, format as string): saves the barcode to a file, the format parameter can be PNG, BMP , GIF , EMF , TIFF or PICT. Note however not all formats are supported in all platforms (see Realbasic documentation).

Properties

  • autoConfigurate: if true the preferredConfiguration can be ignored if the data does not fit.
  • barForeColor: color of the bars, the default value is black. You can also use the RGB numeric value of a color as parameter. For example &FF0000 is red (RGB format), &00FF00 is green and so on.
  • barBackColor: color of the background, the default value is white.
  • code: string to be encoded.
  • codeBinary() as integer(): use the property to encode binary data.
  • useBinary: set this property to true to encode the codeBinary value.
  • configurationType: use this property to define which formats can be used: tConfigurationType.CONFIGURATION_ANY (any), tConfigurationType.CONFIGURATION_COMPACT (only compact formats) or tConfigurationType.CONFIGURATION_FULL (only full range formats).
  • correctionLevel: percentage of errors which can be recovered (default is 23, 23%)
  • currentX (read only): final position of the cursor. Use this properry to find out the size of the image in pixels.
  • currentY (read only): final position of the cursor. Use this properry to find out the size of the image in pixels.
  • encoding: encoding mode (default is tEncoding.NORMAL). Valid values are:
    • tEncoding.NORMAL: can encode any character but it is not very efficient encoding binary values (values above 128).
    • tEncoding.BINARY: use this mode only if your data contains many bytes/characters above 128.
  • margin: left and top margin in pixels (default is 30).
  • moduleSize: number of pixels which make a module (square) in the barcode (default is 4).
  • preferredConfiguration: preferred format. Another format will be automatically selected if AutoConfigurate=true and the amount of data and the selected error correction level does not fit in the preferred format. Valid values are tConfiguration.CONFIGURATION_15X15_COMPACT, tConfiguration.CONFIGURATION_19X19 .... and so on (see table).
  • processTilde: if true (default) the tilde character (~) will be processed like this:
    • ~~: 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.
  • redraw: set this property to true if you need to rebuild the barcode.
  • readerInitialization: if true the reader initialization flag will be set.
  • rune: set a value between 0 and 255 to create a Aztec code rune (default is -1, disabled)
  • topMargin: top margin in pixels (default is 10).
  • height and  width: size of the image holding the barcode, the default size is 200x200.

Structured Append properties

  • structuredAppend: if true, the structured append mode is enabled (default is false).
  • StructuredAppendCounter: number of symbols which make the sequence.
  • StructuredAppendIndex: position of current symbol within the secuence (starting at 0).
  • fileId: file identifier for structured append (recommended to use uppercase characters only).

 

Custom control

The class J4LAztecCanvas is a custom control that is an extension of the Canvas control. Once this file has been imported in your project, this control can be used as any other control, it can be found in the project control list:

The azteccode  property of the control can be used to access the underlying J4LAztec class. In the following screenshot you can see the properties of the control (they have the same names as the underlying J4LAztec class).

 

 

Questions?

Contact us at java4less@confluencia.net if you have any questions.