itext.barcodes A type of barcode A type of barcode A type of barcode The bars to generate the code. The stop bars. The charset code change. The charset code change. The charset code change. The code for UCC/EAN-128. The start code. The start code. The start code. Creates new Barcode128. Creates new Barcode128. To generate the font the will be implicitly called. If you want to use this barcode in PDF/A documents, please consider using . The document to which the barcode will be added Creates new Barcode128, which will use the provided font The document to which the barcode will be added The font to use Removes the FNC1 codes in the text. The text to clean The cleaned text Gets the human readable text of a sequence of AI. the text the human readable text Converts the human readable text to the characters needed to create a barcode using the specified code set. the text to convert true if it is an UCC/EAN-128. In this case the character FNC1 is added forced code set, or AUTO for optimized barcode. the code ready to be fed to getBarsCode128Raw() Converts the human readable text to the characters needed to create a barcode. Converts the human readable text to the characters needed to create a barcode. Some optimization is done to get the shortest code. the text to convert true if it is an UCC/EAN-128. In this case the character FNC1 is added the code ready to be fed to getBarsCode128Raw() Generates the bars. Generates the bars. The input has the actual barcodes, not the human readable text. the barcode the bars Gets the maximum area that the barcode and the text, if any, will occupy. Gets the maximum area that the barcode and the text, if any, will occupy. The lower left corner is always (0, 0). the size the barcode occupies. Places the barcode in a PdfCanvas. Places the barcode in a PdfCanvas. The barcode is always placed at coordinates (0, 0). Use the translation matrix to move it elsewhere. The bars and text are written in the following colors:
barColor textColor Result
null null bars and text painted with current fill color
barColor null bars and text painted with barColor
null textColor bars painted with current color
text painted with textColor
barColor textColor bars painted with barColor
text painted with textColor
the PdfCanvas where the barcode will be placed the color of the bars. It can be null the color of the text. It can be null the dimensions the barcode occupies
Sets the code to generate. Sets the code to generate. If it's an UCC code and starts with '(' it will be split by the AI. This code in UCC mode is valid:
(01)00000090311314(10)ABC123(15)060916
the code to generate
Returns true if the next numDigits starting from index textIndex are numeric skipping any FNC1. the text to check where to check from the number of digits to check the check result Packs the digits for charset C also considering FNC1. Packs the digits for charset C also considering FNC1. It assumes that all the parameters are valid. the text to pack where to pack from the number of digits to pack. It is always an even number the packed digits, two digits per character The minimum bar width. The bar multiplier for wide bars or the distance between bars for Postnet and Planet. The text font. The text font. null if no text. The size of the text or the height of the shorter bar in Postnet. If positive, the text distance under the bars. If positive, the text distance under the bars. If zero or negative, the text distance above the bars. The height of the bars. The text alignment. The optional checksum generation. Shows the generated checksum in the the text. Show the start and stop character '*' in the text for the barcode 39 or 'ABCD' for codabar. Generates extended barcode 39. The code to generate. Show the guard bars for barcode EAN. The code type. The ink spreading. The alternate text to be used, if present. Gets the minimum bar width. the minimum bar width Sets the minimum bar width. the minimum bar width Gets the bar multiplier for wide bars. the bar multiplier for wide bars Sets the bar multiplier for wide bars. the bar multiplier for wide bars Gets the text font. Gets the text font. null if no text. the text font. null if no text Sets the text font. the text font. Set to null to suppress any text Sets the size of the text. the size of the text Gets the text baseline. Gets the text baseline. If positive, the text distance under the bars. If zero or negative, the text distance above the bars. the baseline. Sets the text baseline. Sets the text baseline. If positive, the text distance under the bars. If zero or negative, the text distance above the bars. the baseline. Gets the height of the bars. the height of the bars Sets the height of the bars. the height of the bars Gets the text alignment. the text alignment Sets the text alignment. the text alignment Gets the optional checksum generation. the optional checksum generation Setter for property generateChecksum. New value of property generateChecksum. Gets the property to show the generated checksum in the the text. value of property checksumText Sets the property to show the generated checksum in the the text. new value of property checksumText Sets the property to show the start and stop character '*' in the text for the barcode 39. value of property startStopText Gets the property to show the start and stop character '*' in the text for the barcode 39. new value of property startStopText Gets the property to generate extended barcode 39. value of property extended. Sets the property to generate extended barcode 39. new value of property extended Gets the code to generate. the code to generate Sets the code to generate. the code to generate Gets the property to show the guard bars for barcode EAN. value of property guardBars Sets the property to show the guard bars for barcode EAN. new value of property guardBars Gets the code type. the code type Sets the code type. the code type Gets the maximum area that the barcode and the text, if any, will occupy. Gets the maximum area that the barcode and the text, if any, will occupy. The lower left corner is always (0, 0). the size the barcode occupies. Places the barcode in a PdfCanvas. Places the barcode in a PdfCanvas. The barcode is always placed at coordinates (0, 0). Use the translation matrix to move it elsewhere. The bars and text are written in the following colors:
barColor textColor Result
null null bars and text painted with current fill color
barColor null bars and text painted with barColor
null textColor bars painted with current color
text painted with textColor
barColor textColor bars painted with barColor
text painted with textColor
the PdfCanvas where the barcode will be placed the color of the bars. It can be null the color of the text. It can be null the dimensions the barcode occupies
Gets the amount of ink spreading. the ink spreading Sets the amount of ink spreading. Sets the amount of ink spreading. This value will be subtracted to the width of each bar. The actual value will depend on the ink and the printing medium. the ink spreading Gets the alternate text. the alternate text Sets the alternate text. Sets the alternate text. If present, this text will be used instead of the text derived from the supplied code. the alternate text Creates a PdfFormXObject with the barcode. Creates a PdfFormXObject with the barcode. Default bar color and text color will be used. The document The XObject Creates a PdfFormXObject with the barcode. The color of the bars. It can be null The color of the text. It can be null The document the XObject Make the barcode occupy the specified width. Make the barcode occupy the specified width. Usually this is achieved by adjusting bar widths. The width Gets the maximum area that the barcode and the text, if any, will occupy. Gets the maximum area that the barcode and the text, if any, will occupy. The lower left corner is always (0, 0). the size the barcode occupies. Places the barcode in a PdfCanvas. Places the barcode in a PdfCanvas. The barcode is always placed at coordinates (0, 0). Use the translation matrix to move it elsewhere. the PdfCanvas where the barcode will be placed the foreground color. It can be null the dimensions the barcode occupies Creates a PdfFormXObject with the barcode. Creates a PdfFormXObject with the barcode. Default foreground color will be used. The document the XObject. Creates a PdfFormXObject with the barcode. The color of the pixels. It can be null The document the XObject. The bars to generate the code. The index chars to BARS, symbol * use only start and stop characters, the * character will not appear in the input data. The character combinations to make the code 39 extended. Creates a new Barcode39. Creates a new Barcode39. To generate the font the will be implicitly called. If you want to use this barcode in PDF/A documents, please consider using . The document to which the barcode will be added Creates a new Barcode39. The document to which the barcode will be added The font to use Creates the bars. the text to create the bars. This text does not include the start and stop characters the bars Converts the extended text into a normal, escaped text, ready to generate bars. the extended text the escaped text Calculates the checksum. the text the checksum Gets the maximum area that the barcode and the text, if any, will occupy. Gets the maximum area that the barcode and the text, if any, will occupy. The lower left corner is always (0, 0). the size the barcode occupies. Places the barcode in a PdfCanvas. Places the barcode in a PdfCanvas. The barcode is always placed at coordinates (0, 0). Use the translation matrix to move it elsewhere. The bars and text are written in the following colors:
barColor textColor Result
null null bars and text painted with current fill color
barColor null bars and text painted with barColor
null textColor bars painted with current color
text painted with textColor
barColor textColor bars painted with barColor
text painted with textColor
the PdfCanvas where the barcode will be placed the color of the bars. It can be null the color of the text. It can be null the dimensions the barcode occupies
The index chars to BARS. The bars to generate the code. Creates a new BarcodeCodabar. Creates a new BarcodeCodabar. To generate the font the will be implicitly called. If you want to use this barcode in PDF/A documents, please consider using . The document to which the barcode will be added Creates a new BarcodeCodabar. The document to which the barcode will be added The font to use Creates the bars. the text to create the bars the bars Gets the maximum area that the barcode and the text, if any, will occupy. Gets the maximum area that the barcode and the text, if any, will occupy. The lower left corner is always (0, 0). the size the barcode occupies. Places the barcode in a PdfCanvas. Places the barcode in a PdfCanvas. The barcode is always placed at coordinates (0, 0). Use the translation matrix to move it elsewhere. The bars and text are written in the following colors:
barColor textColor Result
null null bars and text painted with current fill color
barColor null bars and text painted with barColor
null textColor bars painted with current color
text painted with textColor
barColor textColor bars painted with barColor
text painted with textColor
the PdfCanvas where the barcode will be placed the color of the bars. It can be null the color of the text. It can be null the dimensions the barcode occupies
No error. The text is too big for the symbology capabilities. The dimensions given for the symbol are illegal. An error while parsing an extension. The best encodation will be used. ASCII encodation. C40 encodation. TEXT encodation. Binary encodation. X12 encodation. EDIFACT encodation. No encodation needed. No encodation needed. The bytes provided are already encoded. Allows extensions to be embedded at the start of the text. Doesn't generate the image but returns all the other information. Creates an instance of this class. Creates a PdfFormXObject with the barcode with given module width and module height. The color of the pixels. It can be null The side (width and height) of the pixels. The document the XObject. Gets the barcode size The height of the module The width of the module The size of the barcode Creates a barcode. Creates a barcode. The String is interpreted with the ISO-8859-1 encoding the text the status of the generation. It can be one of this values: DM_NO_ERROR - no error.
DM_ERROR_TEXT_TOO_BIG - the text is too big for the symbology capabilities.
DM_ERROR_INVALID_SQUARE - the dimensions given for the symbol are illegal.
DM_ERROR_EXTENSION - an error was while parsing an extension.
Creates a barcode. the text the offset to the start of the text the text size the status of the generation. It can be one of this values: DM_NO_ERROR - no error.
DM_ERROR_TEXT_TOO_BIG - the text is too big for the symbology capabilities.
DM_ERROR_INVALID_SQUARE - the dimensions given for the symbol are illegal.
DM_ERROR_EXTENSION - an error was while parsing an extension.
Gets the height of the barcode. Gets the height of the barcode. Will contain the real height used after a successful call to generate(). This height doesn't include the whitespace border, if any. the height of the barcode Sets the height of the barcode. Sets the height of the barcode. If the height is zero it will be calculated. This height doesn't include the whitespace border, if any. The allowed dimensions are (width, height): 10, 10
12, 12
18, 8
14, 14
32, 8
16, 16
26, 12
18, 18
20, 20
36, 12
22, 22
36, 16
24, 24
26, 26
48, 16
32, 32
36, 36
40, 40
44, 44
48, 48
52, 52
64, 64
72, 72
80, 80
88, 88
96, 96
104, 104
120, 120
132, 132
144, 144
the height of the barcode
Gets the width of the barcode. Gets the width of the barcode. Will contain the real width used after a successful call to generate(). This width doesn't include the whitespace border, if any. the width of the barcode Sets the width of the barcode. Sets the width of the barcode. If the width is zero it will be calculated. This width doesn't include the whitespace border, if any. The allowed dimensions are (width, height): 10, 10
12, 12
18, 8
14, 14
32, 8
16, 16
26, 12
18, 18
20, 20
36, 12
22, 22
36, 16
24, 24
26, 26
48, 16
32, 32
36, 36
40, 40
44, 44
48, 48
52, 52
64, 64
72, 72
80, 80
88, 88
96, 96
104, 104
120, 120
132, 132
144, 144
the width of the barcode
Gets the whitespace border around the barcode. the whitespace border around the barcode Sets the whitespace border around the barcode. the whitespace border around the barcode Gets the barcode options. the barcode options Sets the options for the barcode generation. Sets the options for the barcode generation. The options can be: One of:
DM_AUTO - the best encodation will be used
DM_ASCII - ASCII encodation
DM_C40 - C40 encodation
DM_TEXT - TEXT encodation
DM_B256 - binary encodation
DM_X12 - X12 encodation
DM_EDIFACT - EDIFACT encodation
DM_RAW - no encodation. The bytes provided are already encoded and will be added directly to the barcode, using padding if needed. It assumes that the encodation state is left at ASCII after the last byte.

One of:
DM_EXTENSION - allows extensions to be embedded at the start of the text: exxxxxx - ECI number xxxxxx
m5 - macro 5
m6 - macro 6
f - FNC1
saabbccccc - Structured Append, aa symbol position (1-16), bb total number of symbols (2-16), ccccc file identification (0-64515)
p - Reader programming
. - extension terminator Example for a structured append, symbol 2 of 6, with FNC1 and ECI 000005. The actual text is "Hello". s020600075fe000005.Hello One of:
DM_TEST - doesn't generate the image but returns all the other information.
the barcode options
setting encoding for data matrix code ( default encoding iso-8859-1) encoding for data matrix code A type of barcode A type of barcode A type of barcode A type of barcode A type of barcode A type of barcode The bar positions that are guard bars. The bar positions that are guard bars. The bar positions that are guard bars. The bar positions that are guard bars. The bar positions that are guard bars. The x coordinates to place the text. The x coordinates to place the text. The basic bar widths. The total number of bars for EAN13. The total number of bars for EAN8. The total number of bars for UPCE. The total number of bars for supplemental 2. The total number of bars for supplemental 5. Marker for odd parity. Marker for even parity. Sequence of parities to be used with EAN13. Sequence of parities to be used with supplemental 2. Sequence of parities to be used with supplemental 2. Sequence of parities to be used with UPCE. Creates new BarcodeEAN. Creates new BarcodeEAN. To generate the font the will be implicitly called. If you want to use this barcode in PDF/A documents, please consider using . The document to which the barcode will be added Creates new BarcodeEAN The document to which the barcode will be added The font to use Calculates the EAN parity character. the code the parity character Converts an UPCA code into an UPCE code. Converts an UPCA code into an UPCE code. If the code can not be converted a null is returned. the code to convert. It must have 12 numeric characters the 8 converted digits or null if the code could not be converted Creates the bars for the barcode EAN13 and UPCA. the text with 13 digits the barcode Creates the bars for the barcode EAN8. the text with 8 digits the barcode Creates the bars for the barcode UPCE. the text with 8 digits the barcode Creates the bars for the barcode supplemental 2. the text with 2 digits the barcode Creates the bars for the barcode supplemental 5. the text with 5 digits the barcode Gets the maximum area that the barcode and the text, if any, will occupy. Gets the maximum area that the barcode and the text, if any, will occupy. The lower left corner is always (0, 0). the size the barcode occupies. Places the barcode in a PdfCanvas. Places the barcode in a PdfCanvas. The barcode is always placed at coordinates (0, 0). Use the translation matrix to move it elsewhere. The bars and text are written in the following colors:
barColor textColor Result
null null bars and text painted with current fill color
barColor null bars and text painted with barColor
null textColor bars painted with current color
text painted with textColor
barColor textColor bars painted with barColor
text painted with textColor
the PdfCanvas where the barcode will be placed the color of the bars. It can be null the color of the text. It can be null the dimensions the barcode occupies
The barcode with the EAN/UPC. The barcode with the supplemental. Creates new combined barcode. the EAN/UPC barcode the supplemental barcode Gets the maximum area that the barcode and the text, if any, will occupy. Gets the maximum area that the barcode and the text, if any, will occupy. The lower left corner is always (0, 0). the size the barcode occupies. Places the barcode in a PdfCanvas. Places the barcode in a PdfCanvas. The barcode is always placed at coordinates (0, 0). Use the translation matrix to move it elsewhere. The bars and text are written in the following colors:
barColor textColor Result
null null bars and text painted with current fill color
barColor null bars and text painted with barColor
null textColor bars painted with current color
text painted with textColor
barColor textColor bars painted with barColor
text painted with textColor
the PdfCanvas where the barcode will be placed the color of the bars. It can be null the color of the text. It can be null the dimensions the barcode occupies
Implements the code interleaved 2 of 5. Implements the code interleaved 2 of 5. The text can include non numeric characters that are printed but do not generate bars. The default parameters are:
            x = 0.8f;
            n = 2;
            font = new PdfType1Font(document, new TYPE_1_FONT(StandardFonts.HELVETICA, PdfEncodings.WINANSI));
            size = 8;
            baseline = size;
            barHeight = size * 3;
            textAlignment = ALIGN_CENTER;
            generateChecksum = false;
            checksumText = false;
            
The bars to generate the code. Creates new BarcodeInter25. Creates new BarcodeInter25. To generate the font the will be implicitly called. If you want to use this barcode in PDF/A documents, please consider using . The document to which the barcode will be added Creates new BarcodeInter25 The document to which the barcode will be added The font to use Deletes all the non numeric characters from text. the text a String with only numeric characters Calculates the checksum. the numeric text the checksum Creates the bars for the barcode. the text. It can contain non numeric characters the barcode Gets the maximum area that the barcode and the text, if any, will occupy. Gets the maximum area that the barcode and the text, if any, will occupy. The lower left corner is always (0, 0). the size the barcode occupies. Places the barcode in a PdfCanvas. Places the barcode in a PdfCanvas. The barcode is always placed at coordinates (0, 0). Use the translation matrix to move it elsewhere. The bars and text are written in the following colors:
barColor textColor Result
null null bars and text painted with current fill color
barColor null bars and text painted with barColor
null textColor bars painted with current color
text painted with textColor
barColor textColor bars painted with barColor
text painted with textColor
the PdfCanvas where the barcode will be placed the color of the bars. It can be null the color of the text. It can be null the dimensions the barcode occupies
Implements the MSI Barcode. Implements the MSI Barcode. The code may only contain numeric characters. The getChecksum method returns the mod 10 checksum digit which is the most widely used for MSI barcodes. The index chars to BARS representing valid characters in the code The sequence prepended to the start of all MSI Barcodes. The sequence appended to the end of all MSI Barcodes. The bars to generate the code. The number of individual bars either drawn or not drawn per character of the code Creates a new BarcodeMSI. Creates a new BarcodeMSI. To generate the font the will be implicitly called. If you want to use this barcode in PDF/A documents, please consider using . The document to which the barcode will be added Creates a new BarcodeMSI The document to which the barcode will be added The font to use Gets the maximum area that the barcode and the text, if any, will occupy. Gets the maximum area that the barcode and the text, if any, will occupy. The lower left corner is always (0, 0). the size the barcode occupies. Places the barcode in a PdfCanvas. Places the barcode in a PdfCanvas. The barcode is always placed at coordinates (0, 0). Use the translation matrix to move it elsewhere. The bars and text are written in the following colors:
barColor textColor Result
null null bars and text painted with current fill color
barColor null bars and text painted with barColor
null textColor bars painted with current color
text painted with textColor
barColor textColor bars painted with barColor
text painted with textColor
the PdfCanvas where the barcode will be placed the color of the bars. It can be null the color of the text. It can be null the dimensions the barcode occupies
Creates the bars. the text to create the bars. the bars Calculates the mod 10 checksum digit using the Luhn algorithm. the barcode data the checksum digit Auto-size is made based on aspectRatio and yHeight. The size of the barcode will be at least codeColumns*codeRows. The size will be at least codeColumns with a variable number of codeRows. The size will be at least codeRows with a variable number of codeColumns. The error level correction is set automatically according to ISO 15438 recommendations. The error level correction is set by the user. The error level correction is set by the user. It can be 0 to 8. One single binary segment is used No text interpretation is done and the content of codewords is used directly. Inverts the output bits of the raw bitmap that is normally bit one for black. Inverts the output bits of the raw bitmap that is normally bit one for black. It has only effect for the raw bitmap. Use Macro PDF417 Encoding Holds value of property outBits. Holds value of property bitColumns. Holds value of property codeRows. Holds value of property codeColumns. Holds value of property codewords. Holds value of property lenCodewords. Holds value of property errorLevel. Holds value of property code. Holds value of property options. Holds value of property aspectRatio. Holds value of property yHeight. Creates a new BarcodePDF417 with the default settings. Sets the segment id for macro PDF417 encoding the id (starting at 0) Sets the segment count for macro PDF417 encoding the number of macro segments Sets the File ID for macro PDF417 encoding the file id Set the default settings that correspond to PDF417_USE_ASPECT_RATIO and PDF417_AUTO_ERROR_LEVEL. Paints the barcode. Paints the barcode. If no exception was thrown a valid barcode is available. Creates a PdfFormXObject with the barcode. the color of the pixels. It can be null the XObject. Creates a PdfFormXObject with the barcode with given module width and module height. The color of the pixels. It can be null The width of the pixels. The height of the pixels. The document the XObject. Gets the raw image bits of the barcode. Gets the raw image bits of the barcode. The image will have to be scaled in the Y direction by yHeight. The raw barcode image Gets the number of X pixels of outBits. the number of X pixels of outBits Gets the number of Y pixels of outBits. Gets the number of Y pixels of outBits. It is also the number of rows in the barcode. the number of Y pixels of outBits Sets the number of barcode rows. Sets the number of barcode rows. This number may be changed to keep the barcode valid. the number of barcode rows Gets the number of barcode data columns. he number of barcode data columns Sets the number of barcode data columns. Sets the number of barcode data columns. This number may be changed to keep the barcode valid. the number of barcode data columns Gets the codeword array. Gets the codeword array. This array is always 928 elements long. It can be written to if the option PDF417_USE_RAW_CODEWORDS is set. the codeword array Gets the length of the codewords. the length of the codewords Sets the length of the codewords. the length of the codewords Gets the error level correction used for the barcode. Gets the error level correction used for the barcode. It may different from the previously set value. the error level correction used for the barcode Sets the error level correction for the barcode. the error level correction for the barcode Gets the bytes that form the barcode. Gets the bytes that form the barcode. This bytes should be interpreted in the codepage Cp437. the bytes that form the barcode Sets the bytes that form the barcode. Sets the bytes that form the barcode. This bytes should be interpreted in the codepage Cp437. the bytes that form the barcode Sets the code that will form the barcode. Sets the code that will form the barcode. This text is converted to bytes using the encoding Cp437. the text that will form the barcode Gets the options to generate the barcode. the options to generate the barcode Sets the options to generate the barcode. Sets the options to generate the barcode. This can be all the PDF417_* constants. the options to generate the barcode Gets the barcode aspect ratio. the barcode aspect ratio Sets the barcode aspect ratio. Sets the barcode aspect ratio. A ratio or 0.5 will make the barcode width twice as large as the height. the barcode aspect ratio Gets the Y pixel height relative to X. the Y pixel height relative to X Sets the Y pixel height relative to X. Sets the Y pixel height relative to X. It is usually 3. the Y pixel height relative to X The bars for each character. Creates the bars for Postnet. the code to be created without checksum the bars A QRCode implementation based on the zxing code. modifiers to change the way the barcode is create. Creates the QR barcode. the text to be encoded barcode hints. See #setHints for description. Creates the QR barcode with default error correction level (ErrorCorrectionLevel.L) and default character set (ISO-8859-1). the text to be encoded Gets the current data. the encoded data Sets the data to be encoded by the barcode. Sets the data to be encoded by the barcode. If not specified in hints otherwise, the character set should be ISO-8859-1. The data to encode modifiers to change the way the barcode is created. modifiers to change the way the barcode is created. They can be EncodeHintType.ERROR_CORRECTION and EncodeHintType.CHARACTER_SET. For EncodeHintType.ERROR_CORRECTION the values can be ErrorCorrectionLevel.L, M, Q, H. For EncodeHintType.CHARACTER_SET the values are strings and can be Cp437, Shift_JIS and ISO-8859-1 to ISO-8859-16. You can also use UTF-8, but correct behaviour is not guaranteed as Unicode is not supported in QRCodes. The default value is ISO-8859-1. Regenerates barcode after changes in hints or code. Gets the size of the barcode grid Gets the barcode size The module size The size of the barcode * Places the barcode in a PdfCanvas. * Places the barcode in a PdfCanvas. The barcode is always placed at coordinates (0, 0). Use the translation matrix to move it elsewhere. the PdfCanvas where the barcode will be placed the foreground color. It can be null the size of the square grid cell the dimensions the barcode occupies Creates a PdfFormXObject with the barcode. the color of the pixels. It can be null the XObject. Creates a PdfFormXObject with the barcode. The color of the pixels. It can be null The size of the pixels. The document the XObject. Creates a DM code parameter block total height total width height of a single section width of a single section size of the data size of a data-block size of a error-correction block Execute the placement number of rows number of columns array containing appropriate values for ECC200 Calculates the error correction code for the given parameters. bytearray containing the data size of the data size of a datablock size of a errorblock A simple, fast array of bits, represented compactly by an array of ints internally. Sean Owen bit to get. true iff bit i is set Sets bit i. bit to set Flips bit i. bit to set Sets a block of 32 bits, starting at bit i. first bit to set the new value of the next 32 bits. Note again that the least-significant bit corresponds to bit i, the next-least-significant to i+1, and so on. Clears all bits (sets to false). Efficient method to check if a range of bits is set, or not set. start of range, inclusive. end of range, exclusive if true, checks that bits in range are set, otherwise checks that they are not set true iff all bits are set or not set in range, according to value argument underlying array of ints. The first element holds the first 32 bits, and the least significant bit is bit 0. Reverses all bits in the array. Represents a 2D matrix of bits. Represents a 2D matrix of bits. In function arguments below, and throughout the common module, x is the column position, and y is the row position. The ordering is always x, y. The origin is at the top-left. Internally the bits are represented in a 1-D array of 32-bit ints. However, each row begins with a new int. This is done intentionally so that we can copy out a row into a BitArray very efficiently. The ordering of bits is row-major. Within each int, the least significant bits are used first, meaning they represent lower x values. This is compatible with BitArray's implementation. Sean Owen dswitkin@google.com (Daniel Switkin) Gets the requested bit, where true means black. The horizontal component (i.e. which column) The vertical component (i.e. which row) value of given bit in matrix Sets the given bit to true. The horizontal component (i.e. which column) The vertical component (i.e. which row) Flips the given bit. The horizontal component (i.e. which column) The vertical component (i.e. which row) Clears all bits (sets to false). Sets a square region of the bit matrix to true. The horizontal position to begin at (inclusive) The vertical position to begin at (inclusive) The width of the region The height of the region A fast method to retrieve one row of data from the matrix as a BitArray. The row to retrieve An optional caller-allocated BitArray, will be allocated if null or too small The resulting BitArray - this reference should always be used even when passing your own row The width of the matrix The height of the matrix This method is for compatibility with older code. This method is for compatibility with older code. It's only logical to call if the matrix is square, so I'm throwing if that's not the case. row/column dimension of this matrix JAVAPORT: This should be combined with BitArray in the future, although that class is not yet dynamically resizeable. JAVAPORT: This should be combined with BitArray in the future, although that class is not yet dynamically resizeable. This implementation is reasonable but there is a lot of function calling in loops I'd like to get rid of. satorux@google.com (Satoru Takabayashi) - creator dswitkin@google.com (Daniel Switkin) - ported from C++ Create a bitvector usng the default size Return the bit value at "index". index in the vector bit value at "index" the number of bits in the bit vector. the number of bytes in the bit vector. Append the a bit to the bit vector 0 or 1 Append "numBits" bits in "value" to the bit vector. Append "numBits" bits in "value" to the bit vector. Examples: - appendBits(0x00, 1) adds 0. - appendBits(0x00, 4) adds 0000. - appendBits(0xff, 8) adds 11111111. int interpreted as bitvector 0 <= numBits <= 32. Append a different BitVector to this BitVector BitVector to append XOR the contents of this bitvector with the contetns of "other" Bitvector of equal length String representation of the bitvector Callers should not assume that array.length is the exact number of bytes needed to hold sizeInBits - it will typically be larger for efficiency. size of the array containing the bitvector Add a new byte to the end, possibly reallocating and doubling the size of the array if we've run out of room. byte to add. Helper class that groups a block of databytes with its corresponding block of error correction block data block of the pair error correction block of the pair This class implements an array of unsigned bytes. dswitkin@google.com (Daniel Switkin) Creates a new ByteArray instance with size 0. Creates a new ByteArray instance of the specified size. size of the array Creates a new ByteArray instance based on an existing byte[]. the byte[] Access an unsigned byte at location index. The index in the array to access. The unsigned value of the byte as an int. Set the value at "index" to "value" position in the byte-array new value size of the array true if size is equal to 0, false otherwise Append a byte to the end of the array. Append a byte to the end of the array. If the array is too small, it's capacity is doubled. byte to append. Increase the capacity of the array to "capacity" if the current capacity is smaller the new capacity Copy count bytes from array source starting at offset. source of the copied bytes offset to start at number of bytes to copy A class which wraps a 2D array of bytes. A class which wraps a 2D array of bytes. The default usage is signed. If you want to use it as a unsigned container, it's up to you to do byteValue & 0xff at each location. JAVAPORT: The original code was a 2D array of ints, but since it only ever gets assigned -1, 0, and 1, I'm going to use less memory and go with bytes. dswitkin@google.com (Daniel Switkin) Create a ByteMatix of given width and height, with the values initialized to 0 width of the matrix height of the matrix height of the matrix width of the matrix Get the value of the byte at (x,y) the width coordinate the height coordinate the byte value at position (x,y) matrix as byte[][] Set the value of the byte at (x,y) the width coordinate the height coordinate the new byte value Set the value of the byte at (x,y) the width coordinate the height coordinate the new byte value Resets the contents of the entire matrix to value new value of every element String representation Encapsulates a Character Set ECI, according to "Extended Channel Interpretations" 5.3.1.1 of ISO 18004. Sean Owen name of the encoding. the value of the encoding. character set ECI encoding name representing ECI for character encoding, or null if it is legal but unsupported These are a set of hints that you may pass to Writers to specify their behavior. dswitkin@google.com (Daniel Switkin) Specifies what degree of error correction to use, for example in QR Codes (type Integer). Specifies what character encoding to use where applicable (type String) Specifies the minimal version level to use, for example in QR Codes (type Integer). satorux@google.com (Satoru Takabayashi) - creator dswitkin@google.com (Daniel Switkin) - ported from C++ Encode "bytes" with the error correction level "ecLevel". Encode "bytes" with the error correction level "ecLevel". The encoding mode will be chosen internally by chooseMode(). On success, store the result in "qrCode". We recommend you to use QRCode.EC_LEVEL_L (the lowest level) for "getECLevel" since our primary use is to show QR code on desktop screens. We don't need very strong error correction for this purpose. Note that there is no way to encode bytes in MODE_KANJI. We might want to add EncodeWithMode() with which clients can specify the encoding mode. For now, we don't need the functionality. String to encode Error-correction level to use QR code to store the result in Encode "bytes" with the error correction level "ecLevel". Encode "bytes" with the error correction level "ecLevel". The encoding mode will be chosen internally by chooseMode(). On success, store the result in "qrCode". We recommend you to use QRCode.EC_LEVEL_L (the lowest level) for "getECLevel" since our primary use is to show QR code on desktop screens. We don't need very strong error correction for this purpose. Note that there is no way to encode bytes in MODE_KANJI. We might want to add EncodeWithMode() with which clients can specify the encoding mode. For now, we don't need the functionality. String to encode Error-correction level to use Optional Map containing encoding and suggested minimum version to use QR code to store the result in the code point of the table used in alphanumeric mode or -1 if there is no corresponding code in the table. Choose the best mode by examining the content. content to examine mode to use Choose the best mode by examining the content. Choose the best mode by examining the content. Note that 'encoding' is used as a hint; if it is Shift_JIS, and the input is only double-byte Kanji, then we return content to examine hint for the encoding to use mode to use Initialize "qrCode" according to "numInputBytes", "ecLevel", and "mode". Initialize "qrCode" according to "numInputBytes", "ecLevel", and "mode". On success, modify "qrCode". Terminate bits as described in 8.4.8 and 8.4.9 of JISX0510:2004 (p.24). Get number of data bytes and number of error correction bytes for block id "blockID". Get number of data bytes and number of error correction bytes for block id "blockID". Store the result in "numDataBytesInBlock", and "numECBytesInBlock". See table 12 in 8.5.1 of JISX0510:2004 (p.30) Interleave "bits" with corresponding error correction bytes. Interleave "bits" with corresponding error correction bytes. On success, store the result in "result". The interleave rule is complicated. See 8.6 of JISX0510:2004 (p.37) for details. Append mode info. Append mode info. On success, store the result in "bits". Append length info. Append length info. On success, store the result in "bits". Append "bytes" in "mode" mode (encoding) into "bits". Append "bytes" in "mode" mode (encoding) into "bits". On success, store the result in "bits". See ISO 18004:2006, 6.5.1. See ISO 18004:2006, 6.5.1. This enum encapsulates the four error correction levels defined by the QR code standard. Sean Owen L = ~7% correction M = ~15% correction Q = ~25% correction H = ~30% correction Gets the ordinal value. the ordinal int containing the two bits encoding a QR Code's error correction level representing the encoded error correction level Encapsulates a QR Code's format information, including the data mask used and error correction level. Sean Owen See ISO 18004:2006, Annex C, Table C.1 Offset i holds the number of 1 bits in the binary representation of i format info indicator, with mask still applied second copy of same info; both are checked at the same time to establish best match information about the format it specifies, or null if doesn't seem to match any known pattern The datamask in byte-format the hashcode of the QR-code format information Compares the Format Information of this and o object to compare to True if o is a FormatInformationObject and the error-correction level and the datamask are equal, false otherwise This class contains utility methods for performing mathematical operations over the Galois Field GF(256). This class contains utility methods for performing mathematical operations over the Galois Field GF(256). Operations use a given primitive polynomial in calculations. Throughout this package, elements of GF(256) are represented as an int for convenience and speed (but at the cost of memory). Only the bottom 8 bits are really used. Sean Owen Create a representation of GF(256) using the given primitive polynomial. irreducible polynomial whose coefficients are represented by the bits of an int, where the least-significant bit represents the constant coefficient the monomial representing coefficient * x^degree Implements both addition and subtraction -- they are the same in GF(256). sum/difference of a and b 2 to the power of a in GF(256) base 2 log of a in GF(256) multiplicative inverse of a product of a and b in GF(256) Represents a polynomial whose coefficients are elements of GF(256). Represents a polynomial whose coefficients are elements of GF(256). Instances of this class are immutable. Much credit is due to William Rucklidge since portions of this code are an indirect port of his C++ Reed-Solomon implementation. Sean Owen the instance representing the field to use to perform computations coefficients as ints representing elements of GF(256), arranged from most significant (highest-power term) coefficient to least significant degree of this polynomial true iff this polynomial is the monomial "0" coefficient of x^degree term in this polynomial evaluation of this polynomial at a given point GF addition or subtraction (they are identical for a GF(2^n) the other GF-poly new GF256Poly obtained by summing this GF and other GF multiplication the other GF-poly new GF-poly obtained by multiplying this with other GF scalar multiplication scalar new GF-poly obtained by multiplying every element of this with the scalar. String representation of the Galois Field polynomial. satorux@google.com (Satoru Takabayashi) - creator dswitkin@google.com (Daniel Switkin) - ported from C++ Apply mask penalty rule 1 and return the penalty. Apply mask penalty rule 1 and return the penalty. Find repetitive cells with the same color and give penalty to them. Example: 00000 or 11111. ByteMatrix to apply the penalty rule to the rule 1 penalty Apply mask penalty rule 2 and return the penalty. Apply mask penalty rule 2 and return the penalty. Find 2x2 blocks with the same color and give penalty to them. ByteMatrix to apply the penalty rule to the rule 2 penalty Apply mask penalty rule 3 and return the penalty. Apply mask penalty rule 3 and return the penalty. Find consecutive cells of 00001011101 or 10111010000, and give penalty to them. If we find patterns like 000010111010000, we give penalties twice (i.e. 40 * 2). ByteMatrix to apply the penalty rule to the rule 3 penalty Apply mask penalty rule 4 and return the penalty. Apply mask penalty rule 4 and return the penalty. Calculate the ratio of dark cells and give penalty if the ratio is far from 50%. It gives 10 penalty for 5% distance. Examples: - 0% => 100 - 40% => 20 - 45% => 10 - 50% => 0 - 55% => 10 - 55% => 20 - 100% => 100 Bytematrix to apply the rule to the rule 4 penalty Return the mask bit for "getMaskPattern" at "x" and "y". Return the mask bit for "getMaskPattern" at "x" and "y". See 8.8 of JISX0510:2004 for mask pattern conditions. masking pattern to use width coordiante height-coordinate the mask bit at that position satorux@google.com (Satoru Takabayashi) - creator dswitkin@google.com (Daniel Switkin) - ported from C++ Build 2D matrix of QR Code from "dataBits" with "ecLevel", "version" and "getMaskPattern". Build 2D matrix of QR Code from "dataBits" with "ecLevel", "version" and "getMaskPattern". On success, store the result in "matrix". BitVector containing the databits Error correction level of the QR code (L,M,Q,H) Version of the QR code, [1 .. 40] masking pattern Bytematrix in which the output will be stored Embed basic patterns. Embed basic patterns. On success, modify the matrix. The basic patterns are: - Position detection patterns - Timing patterns - Dark dot at the left bottom corner - Position adjustment patterns, if need be Version of the QR code, [1 .. 40] Bytematrix in which the output will be stored Embed type information into the matrix The error correction level (L,M,Q,H) the masking pattern Bytematrix in which the output will be stored Embed version information if need be. Embed version information if need be. For version < 7, version info is not necessary On success, the matrix is modified See 8.10 of JISX0510:2004 (p.47) for how to embed version information. QR code version Byte matrix representing the QR code Embed "dataBits" using "getMaskPattern". Embed "dataBits" using "getMaskPattern". On success, the matrix is modified For debugging purposes, it skips masking process if "getMaskPattern" is -1. See 8.7 of JISX0510:2004 (p.38) for how to embed data bits. data bits to embed in the QR code masking pattern to apply to the data bits Byte matrix representing the QR code Return the position of the most significant bit set (to one) in the "value". Return the position of the most significant bit set (to one) in the "value". The most significant bit is position 32. If there is no bit set, return 0. Examples: - findMSBSet(0) => 0 - findMSBSet(1) => 1 - findMSBSet(255) => 8 bitstring as integer the position of the most significant bit set to 1 in the bit-representation of value Calculate BCH (Bose-Chaudhuri-Hocquenghem) code for "value" using polynomial "poly". Calculate BCH (Bose-Chaudhuri-Hocquenghem) code for "value" using polynomial "poly". The BCH code is used for encoding type information and version information. Example: Calculation of version information of 7. f(x) is created from 7. - 7 = 000111 in 6 bits - f(x) = x^2 + x^2 + x^1 g(x) is given by the standard (p. 67) - g(x) = x^12 + x^11 + x^10 + x^9 + x^8 + x^5 + x^2 + 1 Multiply f(x) by x^(18 - 6) - f'(x) = f(x) * x^(18 - 6) - f'(x) = x^14 + x^13 + x^12 Calculate the remainder of f'(x) / g(x) x^2 __________________________________________________ g(x) )x^14 + x^13 + x^12 x^14 + x^13 + x^12 + x^11 + x^10 + x^7 + x^4 + x^2 -------------------------------------------------- x^11 + x^10 + x^7 + x^4 + x^2 The remainder is x^11 + x^10 + x^7 + x^4 + x^2 Encode it in binary: 110010010100 The return value is 0xc94 (1100 1001 0100) Since all coefficients in the polynomials are 1 or 0, we can do the calculation by bit operations. We don't care if cofficients are positive or negative. the bitstring to calculate the BCH Code from the polynomial in GF[2^n] to use Make bit vector of type information. Make bit vector of type information. On success, store the result in "bits". Encode error correction level and mask pattern. See 8.9 of JISX0510:2004 (p.45) for details. error correction level of the QR code masking pattern to use Vactor of bits to contain the result Make bit vector of version information. Make bit vector of version information. On success, store the result in "bits". See 8.10 of JISX0510:2004 (p.45) for details. Version of the QR-code Vector of bits to contain the result See ISO 18004:2006, 6.4.1, Tables 2 and 3. See ISO 18004:2006, 6.4.1, Tables 2 and 3. This enum encapsulates the various modes in which data can be encoded to bits in the QR code standard. Sean Owen four bits encoding a QR Code data mode encoded by these bits version in question number of bits used, in this QR Code symbol , to encode the count of characters that will follow encoded in this the bits of the mode the name of the mode. the name of the mode. satorux@google.com (Satoru Takabayashi) - creator dswitkin@google.com (Daniel Switkin) - ported from C++ Create a QR-code object with unitialized parameters Mode used by the QR code to encode data into bits. Mode used by the QR code to encode data into bits. Possible values: TERMINATOR, NUMERIC, ALPHANUMERIC, STRUCTURED_APPEND, BYTE, ECI, KANJI, FNC1_FIRST_POSITION, FNC2_SECOND_POSITION Mode of the QR Code. Possible error correction level values ranked from lowest error correction capability to highest: L, M, Q, H Error correction level of the QR Code. Together with error correction level, the version determines the information capacity of the QR code. Together with error correction level, the version determines the information capacity of the QR code. Higher version numbers correspond with higher capacity. Ranges from 1 to 40. Version of the QR Code. ByteMatrix width of the QR Code. Mask pattern of the QR Code. Number of total bytes in the QR Code. Number of data bytes in the QR Code. Number of error correction bytes in the QR Code. Number of Reedsolomon blocks in the QR Code. ByteMatrix data of the QR Code. Retrieve the value of the module (cell) pointed by "x" and "y" in the matrix of the QR Code. Retrieve the value of the module (cell) pointed by "x" and "y" in the matrix of the QR Code. 1 represents a black cell, and 0 represents a white cell. width coordinate height coordinate 1 for a black cell, 0 for a white cell Check the validity of all member variables true if all variables are valid, false otherwise Prints all parameters string containing all parameters Set the data encoding mode of the QR code Possible modes: TERMINATOR, NUMERIC, ALPHANUMERIC, STRUCTURED_APPEND, BYTE, ECI, KANJI, FNC1_FIRST_POSITION, FNC2_SECOND_POSITION new data encoding mode Set the error correction level of th QR code. Set the error correction level of th QR code. Possible error correction level values ranked from lowest error correction capability to highest: L, M, Q, H new error correction level Set the version of the QR code. Set the version of the QR code. Together with error correction level, the version determines the information capacity of the QR code. Higher version numbers correspond with higher capacity. Range: 1 to 40. the new version of the QR code Sets the width of the byte matrix the new width of the matrix Set the masking pattern new masking pattern of the QR code Set the number of total bytes new number of total bytes Set the number of data bytes new number of data bytes Set the number of error correction blocks new number of error correction blocks Set the number of Reed-Solomon blocks new number of Reed-Solomon blocks Set the byte-matrix the new byte-matrix Check if "mask_pattern" is valid. masking pattern to check true if the pattern is valid, false otherwise This object renders a QR Code as a ByteMatrix 2D array of greyscale values. dswitkin@google.com (Daniel Switkin) Encode a string into a QR code with dimensions width x height, using error-correction level L and the smallest version for which he contents fit into the QR-code? String to encode into the QR code width of the QR-code height of the QR-code 2D Greyscale map containing the visual representation of the QR-code, stored as a Bytematrix Encode a string into a QR code with dimensions width x height. Encode a string into a QR code with dimensions width x height. Hints contains suggestions for error-correction level and version. The default error-correction level is L, the default version is the smallest version for which the contents will fit into the QR-code. String to encode into the QR code width of the QR-code height of the QR-code Map containing suggestions for error-correction level and version 2D Greyscale map containing the visual representation of the QR-code, stored as a Bytematrix Implements Reed-Solomon encoding, as the name implies. Sean Owen William Rucklidge Creates a SolomonEncoder object based on a object. Creates a SolomonEncoder object based on a object. Only QR codes are supported at the moment. the galois field Encodes the provided data. data to encode error correction bytes Thrown when an exception occurs during Reed-Solomon decoding, such as when there are too many errors to correct. Sean Owen Creates a ReedSolomonException with a message. the message of the exception See ISO 18004:2006 Annex D. Sean Owen See ISO 18004:2006 Annex D. See ISO 18004:2006 Annex D. Element i represents the raw version bits that specify version i + 7 the version number int[] containing the positions of the alignment pattern centers total number of code words the square dimension for the current version number error correction level the number of EC blocks for the given error correction level Deduces version information purely from QR Code dimensions. dimension in modules for a QR Code of that dimension Version number the version for the given version number Decode the version information. bits stored as int containing Version decoded from the versionBits Build the function pattern, See ISO 18004:2006 Annex E. Bitmatrix containing the pattern Encapsulates a set of error-correction blocks in one symbol version. Encapsulates a set of error-correction blocks in one symbol version. Most versions will use blocks of differing sizes within one version, so, this encapsulates the parameters for each set of blocks. It also holds the number of error-correction codewords per block since it will be the same across all blocks within one version. The number of error-correction words per block the total number of error-correction words Encapsualtes the parameters for one error-correction block in one symbol version. Encapsualtes the parameters for one error-correction block in one symbol version. This includes the number of data codewords, and the number of times a block with these parameters is used consecutively in the QR code version's format. The version number as a string See ISO 18004:2006 6.5.1 Table 9. A base class which covers the range of exceptions which may occur when encoding a barcode using the Writer framework. dswitkin@google.com (Daniel Switkin) Creates a WriterException. Creates a WriterException with a message. message of the exception