Module:Bar
From Jpaliowiki EN
Contents |
Introduction
The Bar module supports creation of barcodes in jPALIO and is accessible within each instance without any further declarations. All generated barcodes are image files in PNG format.
Available barcode types
- Code 39 - encodes the following 43 alphanumeric characters: 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-.$/+%* and space (the * character marks the beginning and the end of the code).
- Code 128 - encodes the first 128 ASCII characters (of codes 0 to 127)
- Interleaved 2 of 5 - encodes digits
- Codabar - encodes the following 20 alphanumeric characters: 0123456789ABCD-$:/.+
- POSTNET - encodes digits
- EAN 8 - encodes a sequence of 8 digits
- EAN 13 - encodes a sequence of 13 digits
- UPC-A - encodes a sequence of 12 digits
- UPC-E - encodes a sequence of 12 digits
Creating barcodes
Generating barcodes
For each of the barcodes there are two methods defined
- byte[] ...(String code, Map params)
- String ...URL(String code, Map params)
The first one returns an array of bytes representing the content of barcode image file. The second one returns an URL address for the generated barcode image file.
Each of these methods requires two arguments
- code - sequence of characters to be encoded within the barcode
- params - barcode parameters map
Instead of dots within the above methods one should use
- code39Bar for the Code 39 code
- code128Bar for the Code 128 code
- inter25Bar for the Interleaved 2 of 5 code
- codaBar for the Codabar code
- postnetBar for the POSTNET code
- ean8Bar for the EAN 8 code
- ean13Bar for the EAN 13 code
- upcaBar for the UPC-A code
- upceBar for the UPC-E code
Barcode parameters
Barcode parameters are passed to generating methods as a map.
For each type of barcode the following parameters have been defined
- Long/BigDecimal BarHeight - barcode bars height in mm
- String FontName - message font family name (Arial, Helvetica ...)
- String MsgPosition - message position with respect to barcode (None, Top, Bottom)
- Long/BigDecimal FontSize - message font size in mm
- Long/BigDecimal Height - barcode bars with message total height in mm
- Long/BigDecimal ModuleWidth - width of the narrowest bar in mm
- Long/BigDecimal QuietZone - width of the image margins in mm
- Long/BigDecimal Resolution - resolution of the image in dpi (default 150)
- Long/BigDecimal Orientation - rotation angle of the image in degrees: 0, 90, -90, 180, -180, 270 and -270 (default 0)
- Boolean AntiAlias - borders antialiasing (default false)
It is recommended to generate barcodes with the resolution of at least 150 dpi (preferably 300 dpi).
Lower resolutions may lead barcode bars to adhere and as a result give invalid barcodes.
It is always possible to scale the generated barcode down to the required dimensions.
Particular barcode types may have some specific parameters. These are specified in jPALIO modules documentation.
Exapmles
The Code 128 barcode for the following sequence of characters: jPALIO in 300 dpi resolution
$=(params, $util.emptyMap())
$util.put((Map)$params, "Resolution", 300)
<img src="$bar.code128BarURL("jPALIO", (Map)$params)">
Summary
Main features of the Bar module are
- multiple barcode types generation
- flexible barcodes formatting
- wide variety of applications: agreements and licences printouts, stickers, labels and other overprints
