|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.faceless.pdf2.AbstractBarCode
org.faceless.pdf2.MaxiCode
The MaxiCode class represents the two-dimensional Barcode methodology called "MaxiCode", originally developed by UPS to barcode packages for delivery, and now in the public domain.
MaxiCodes are always a fixed size - 80 points square - and may encode up to 93 alphanumeric characters or 138 numbers, using reed-solomon error correction to ensure accurate scanning. Only the first 256 Unicode characters (equivalent to ISO-8859-1) may be used - although the full MaxiCode specification theoretically allows other character sets to be used, we don't support them yet.
This API provides three possible ways to create a MaxiCode:this constructor
. The resulting MaxiCode will be a mode 2 or 3 MaxiCode, depending on
whether the supplied postcode is numeric or alphanumeric. An address
may also be created by calling this constructor
with a "Structured Carrier Message" as defined in section B.2 of the MaxiCode
spec. Generally speaking, this is a string beginning with the characters "])>
".
MaxiCode(String,boolean)
constructor. The MaxiCode will be created
as mode 4 or 5, depending on whether extended error correction is chosen.
MaxiCode(byte[])
and
specifying each one of the cells.
SHIFTA
, LATCHB
and LOCK
directly into their text.
Note that when calling the PDFPage.drawBarCode
or
PDFCanvas.drawBarCode
method, the size of the
barcode should be equal to exactly 80 points. This is the equivalent of 28.2222mm
or 1.1111 inches. This allows for the size of the actual code (25.5mm square) plus
the required quiet space around it.
PDFPage.drawBarCode
,
PDFCanvas.drawBarCode
,
BarCode
Field Summary | |
static char |
GS
Represents the "Group Seperator" characters, or 'U+001D'. |
static char |
LATCHA
Represents the "LATCH-A" control character, for possible inclusion in the barcode |
static char |
LATCHB
Represents the "LATCH-B" control character, for possible inclusion in the barcode |
static char |
LOCK
Represents the "LOCK-A", "LOCK-B" and "LOCK-C" control characters, for possible inclusion in the barcode |
static char |
SHIFTA
Represents the "SHIFT-A" control character, for possible inclusion in the barcode |
static char |
SHIFTB
Represents the "SHIFT-B" control character, for possible inclusion in the barcode |
static char |
SHIFTC
Represents the "SHIFT-C" control character, for possible inclusion in the barcode |
static char |
SHIFTD
Represents the "SHIFT-D" control character, for possible inclusion in the barcode |
static char |
SHIFTE
Represents the "SHIFT-E" control character, for possible inclusion in the barcode |
static char |
THREESHIFTA
Represents the "3 SHIFT-A" control character, for possible inclusion in the barcode |
static char |
TWOSHIFTA
Represents the "2 SHIFT-A" control character, for possible inclusion in the barcode |
Constructor Summary | |
MaxiCode(byte[] b)
Create a MaxiCode using the specified raw bytes. |
|
MaxiCode(int service,
String postcode,
int country,
String address)
Create a new MaxiCode representing an address. |
|
MaxiCode(String in,
boolean eec)
Create a new MaxiCode representing an address with the specified message. |
Method Summary | |
static int |
getCountryCode(String code)
Given a two-letter ISO-3166 country code, return the equivalent numeric code to be passed in to the MaxiCode constructor. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final char SHIFTA
public static final char SHIFTB
public static final char SHIFTC
public static final char SHIFTD
public static final char SHIFTE
public static final char TWOSHIFTA
public static final char THREESHIFTA
public static final char LATCHA
public static final char LATCHB
public static final char LOCK
public static final char GS
Constructor Detail |
public MaxiCode(String in, boolean eec)
MaxiCode code = new MaxiCode("This is my first MaxiCode", true); page.drawBarCode(code, x, y, x+72, y+72);If the message begins "])>" then it will be parsed as a "Structured Carrier Message" (an address) according to the section B.2 of the MaxiCode specification.
in
- the string to encode in the messageeec
- whether to use Extended Error Correction (mode 5). If the message
is a Structured Carrier Message, this parameter is ignored.public MaxiCode(int service, String postcode, int country, String address)
MaxiCode code = new MaxiCode(999, "B1050", getCountryCode("BE"), "Comité Européean de Normalisation"+MaxiCode.GS+ "rue de Stassart 36"+MaxiCode.GS+"Bruxelles"and, for a US one
MaxiCode code = new MaxiCode(1, "524032140", getCountryCode("US"), "AIM USA"+MaxiCode.GS+"634 ALPHA DRIVE"+MaxiCode.GS+"PITTSBURGH PA");
service
- The service level, from 1 to 999. We don't know what this
means, but it's part of the spec.postcode
- the postcode of the address, either up to nine numeric
digits or up to six alphanumeric digitscountry
- the numeric ISO-3166 country code. If you only have the two-letter ISO
country code, the getCountryCode(java.lang.String)
method will return the numeric equivalentaddress
- the address to place in the secondary message. Lines in the address
should be separated with the GS
character.public MaxiCode(byte[] b)
b
- a byte array exactly 864 bytes long.Method Detail |
public static final int getCountryCode(String code)
code
- the two-letter ISO-3166 country code
IllegalArgumentException
- if no such country code exists
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |