1 QrCode

Class Ax.barcode.QrCode


A QR Code symbol, which is a type of two-dimension barcode. Invented by Denso Wave and described in the ISO/IEC 18004 standard.

Constructor Summary

MethodDescription
JSQrCode(String text)Returns a QR Code representing the specified Unicode text string at MEDIUM error correction level.
JSQrCode(String text, String level)Returns a QR Code representing the specified Unicode text string at the specified error correction level.

Method Summary

Modifier and TypeMethodDescription
byte[] toPNG()Returns a raster image depicting this QR Code, with module scale 10 and 4 border modules.
byte[] toPNG(int scale, int border)Returns a raster image depicting this QR Code, with the specified module scale and border modules.
String toSVG()Returns a string of SVG code for an image depicting this QR Code, with 4 border modules.
String toSVG(int border)Returns a string of SVG code for an image depicting this QR Code, with the specified number of border modules.

Method Detail

JSQrCode

 JSQrCode(String text)
Info:
Returns a QR Code representing the specified Unicode text string at MEDIUM error correction level. As a conservative upper bound, this function is guaranteed to succeed for strings that have 738 or fewer Unicode code points (not UTF-16 code units) if the low error correction level is used. The smallest possible QR Code version is automatically chosen for the output. The error level of the result may be higher than MEDIUM if it can be done without increasing the version.
Parameters:
text - the text to be encoded (not null), which can be any Unicode string

Example
Copy
new Ax.barcode.QrCode("Hello, world!");

JSQrCode

 JSQrCode(String text, String level)
Info:
Returns a QR Code representing the specified Unicode text string at the specified error correction level. As a conservative upper bound, this function is guaranteed to succeed for strings that have 738 or fewer Unicode code points (not UTF-16 code units) if the low error correction level is used. The smallest possible QR Code version is automatically chosen for the output. The error level of the result may be higher than the level argument if it can be done without increasing the version.
Parameters:
text - the text to be encoded (not null), which can be any Unicode string
level - the error correction level to use (not null) (boostable)

Example
Copy
new Ax.barcode.QrCode("Hello, world!");

toPNG

byte[] toPNG()
Info:
Returns a raster image depicting this QR Code, with module scale 10 and 4 border modules.
Returns:
a new image representing this QR Code, with padding and scaling

toPNG

byte[] toPNG(int scale, int border)
Info:
Returns a raster image depicting this QR Code, with the specified module scale and border modules.
Parameters:
scale - the side length (measured in pixels, must be positive) of each module
border - the number of border modules to add, which must be non-negative
Returns:
a new image representing this QR Code, with padding and scaling

toSVG

                        String toSVG()
Info:
Returns a string of SVG code for an image depicting this QR Code, with 4 border modules. The string always uses Unix newlines (\n), regardless of the platform.
Returns:
a string representing this QR Code as an SVG XML document

toSVG

                        String toSVG(int border)
Info:
Returns a string of SVG code for an image depicting this QR Code, with the specified number of border modules. The string always uses Unix newlines (\n), regardless of the platform.
Parameters:
border - the number of border modules to add, which must be non-negative
Returns:
a string representing this QR Code as an SVG XML document

2 PDF417

Class Ax.barcode.PDF417


Generates the 2D barcode PDF417. Supports dimensioning auto-sizing, fixed and variable sizes, automatic and manual error levels, raw codeword input, codeword size optimization and bitmap inversion. The output can bean image as a byte array.

Constructor Summary

MethodDescription
JSPDF417(String text)Creates a new JSPDF417 with the default settings.

Method Summary

Modifier and TypeMethodDescription
com.itextpdf.text.Rectangle getBarCodeSize()Gets the size of the barcode grid.
void setCodeCols(int cols)Sets the number of barcode data columns.
void setCodeRows(int rows)Sets the number of barcode rows.
void setErrorLevel(int level)Sets the error level correction for the barcode.
void setOptions(int options)Sets the options to generate the barcode.
void setYHeight(int height)Sets the Y pixel height relative to X.
byte[] toPNG()Generates the PDF417 barcode as image bytes.

Method Detail

JSPDF417

 JSPDF417(String text)
Info:
Creates a new JSPDF417 with the default settings.
Parameters:
text - text to encode

Example
Copy
new Ax.barcode.PDF417("ABCabc123");

getBarCodeSize

com.itextpdf.text.Rectangle getBarCodeSize()
Info:
Gets the size of the barcode grid.
Returns:
the size of the barcode grid

setCodeCols

void setCodeCols(int cols)
Info:
Sets the number of barcode data columns. This number may be changed to keep the barcode valid.
Parameters:
cols - the number of barcode data columns

setCodeRows

void setCodeRows(int rows)
Info:
Sets the number of barcode rows. This number may be changed to keep the barcode valid.
Parameters:
rows - the number of barcode rows

setErrorLevel

void setErrorLevel(int level)
Info:
Sets the error level correction for the barcode.
Parameters:
level - the error level correction for the barcode

setOptions

void setOptions(int options)
Info:
Sets the options to generate the barcode. This can be all the PDF417_* constants.
Parameters:
options - the options to generate the barcode

setYHeight

void setYHeight(int height)
Info:
Sets the Y pixel height relative to X. It is usually 3.
Parameters:
height - the Y pixel height relative to X

toPNG

byte[] toPNG()
Info:
Generates the PDF417 barcode as image bytes.
Returns:
image as a byte array

3 SVG

Class Ax.barcode.SVG


Scalable Vector Graphics (SVG) is an Extensible Markup Language (XML)-based vector image format for two-dimensional graphics with support for interactivity and animation. The SVG specification is an open standard developed by the World Wide Web Consortium (W3C) since 1999. You can generate SVG barcodes for: UPC A UPC E EAN 13 3of9 Code 128

Constructor Summary

MethodDescription
JSSVGBarcode(String text)Creates a SVG code representing the specified string.

Method Summary

Modifier and TypeMethodDescription
JSSVGBarcode setHeight(double height)Sets the pattern height (= bar length) in mm.
JSSVGBarcode setModule(double module)Sets the width of the elementary unit bar/space.
JSSVGBarcode setPrintText(boolean print)Sets print text, that is, the text under the SVGCode.
JSSVGBarcode setXMLHeader(boolean print)Sets xml header.
String to3of9()Generates SVG in 3of9 format.
String toCode128()Generates SVG in Code128 format.
String toEAN13()Generates SVG in EAN13 format.
String toInt2of5()Generates SVG in Int2of5 format.
String toUPCA()Generates SVG String in UPCA format.
String toUPCE()Generates SVG in UPCE format.

Method Detail

JSSVGBarcode

 JSSVGBarcode(String text)
Info:
Creates a SVG code representing the specified string.
Parameters:
text - text to encode

Example
Copy
new Ax.barcode.SVG("042100005264");

setHeight

                        JSSVGBarcode setHeight(double height)
Info:
Sets the pattern height (= bar length) in mm.
Parameters:
height - height of the barcode in mm
Returns:
object with height updated

setModule

                        JSSVGBarcode setModule(double module)
Info:
Sets the width of the elementary unit bar/space.
Parameters:
module - width of the bars and spaces in mm
Returns:
object with module updated

setPrintText

                        JSSVGBarcode setPrintText(boolean print)
Info:
Sets print text, that is, the text under the SVGCode. When set to true, the text will be printed under the SVG barcode. When set to false, the text will not be printed.
Parameters:
print - true to set print text, false otherwise
Returns:
object with print text updated

setXMLHeader

                        JSSVGBarcode setXMLHeader(boolean print)
Info:
Sets xml header. When set to true, the xml header will be added to the SVG. When set to false, the xml header will not be added.
Parameters:
print - true to set xml header, false otherwise
Returns:
object with xml header updated

to3of9

                        String to3of9()
Info:
Generates SVG in 3of9 format.
Returns:
SVG in 3of9 format

toCode128

                        String toCode128()
Info:
Generates SVG in Code128 format.
Returns:
SVG in Code128 format

toEAN13

                        String toEAN13()
Info:
Generates SVG in EAN13 format.
Returns:
SVG in EAN13 format

toInt2of5

                        String toInt2of5()
Info:
Generates SVG in Int2of5 format.
Returns:
SVG in Int2of5 format

toUPCA

                        String toUPCA()
Info:
Generates SVG String in UPCA format.
Returns:
SVG in UPCA format

toUPCE

                        String toUPCE()
Info:
Generates SVG in UPCE format.
Returns:
SVG in UPCE format