iText 9.0.0 API
iText.Barcodes.BarcodeDataMatrix Class Reference

A Data Matrix is a two-dimensional bar code consisting of black and white "cells" or dots arranged in either a square or rectangular pattern, also known as a matrix. More...

Inheritance diagram for iText.Barcodes.BarcodeDataMatrix:
iText.Barcodes.Barcode2D

Public Member Functions

  BarcodeDataMatrix ()
  Creates an instance of this class. More...
 
  BarcodeDataMatrix (String code)
  Creates an instance of BarcodeDataMatrix More...
 
  BarcodeDataMatrix (String code, String encoding)
  Creates an instance of BarcodeDataMatrix More...
 
override Rectangle  GetBarcodeSize ()
  Gets the maximum area that the barcode and the text, if any, will occupy. More...
 
override Rectangle  PlaceBarcode (PdfCanvas canvas, Color foreground)
  Places the barcode in a PdfCanvas. More...
 
override PdfFormXObject  CreateFormXObject (Color foreground, PdfDocument document)
  Creates a PdfFormXObject with the barcode. More...
 
virtual PdfFormXObject  CreateFormXObject (Color foreground, float moduleSide, PdfDocument document)
  Creates a PdfFormXObject with the barcode with given module width and module height. More...
 
virtual Rectangle  PlaceBarcode (PdfCanvas canvas, Color foreground, float moduleSide)
  Places the barcode in a PdfCanvas More...
 
virtual Rectangle  GetBarcodeSize (float moduleHeight, float moduleWidth)
  Gets the barcode size More...
 
virtual int  SetCode (String text)
  Creates a barcode. More...
 
virtual int  SetCode (byte[] text, int textOffset, int textSize)
  Creates a barcode. More...
 
virtual int  GetHeight ()
  Gets the height of the barcode. More...
 
virtual void  SetHeight (int height)
  Sets the height of the barcode. More...
 
virtual int  GetWidth ()
  Gets the width of the barcode. More...
 
virtual void  SetWidth (int width)
  Sets the width of the barcode. More...
 
virtual int  GetWs ()
  Gets the whitespace border around the barcode. More...
 
virtual void  SetWs (int ws)
  Sets the whitespace border around the barcode. More...
 
virtual int  GetOptions ()
  Gets the barcode options. More...
 
virtual void  SetOptions (int options)
  Sets the options for the barcode generation. More...
 
virtual void  SetEncoding (String encoding)
  setting encoding for data matrix code ( default encoding iso-8859-1) More...
 
virtual String  GetEncoding ()
  getting encoding for data matrix code More...
 
- Public Member Functions inherited from iText.Barcodes.Barcode2D
virtual PdfFormXObject  CreateFormXObject (PdfDocument document)
  Creates a PdfFormXObject with the barcode. More...
 

Static Public Attributes

const int  DM_NO_ERROR = 0
  No error. More...
 
const int  DM_ERROR_TEXT_TOO_BIG = 1
  The text is too big for the symbology capabilities. More...
 
const int  DM_ERROR_INVALID_SQUARE = 3
  The dimensions given for the symbol are illegal. More...
 
const int  DM_ERROR_EXTENSION = 5
  An error while parsing an extension. More...
 
const int  DM_AUTO = 0
  The best encodation will be used. More...
 
const int  DM_ASCII = 1
  ASCII encodation. More...
 
const int  DM_C40 = 2
  C40 encodation. More...
 
const int  DM_TEXT = 3
  TEXT encodation. More...
 
const int  DM_B256 = 4
  Binary encodation. More...
 
const int  DM_X12 = 5
  X12 encodation. More...
 
const int  DM_EDIFACT = 6
  EDIFACT encodation. More...
 
const int  DM_RAW = 7
  No encodation needed. More...
 
const int  DM_EXTENSION = 32
  Allows extensions to be embedded at the start of the text. More...
 
const int  DM_TEST = 64
  Doesn't generate the image but returns all the other information. More...
 
const String  DEFAULT_DATA_MATRIX_ENCODING = "iso-8859-1"
 

Additional Inherited Members

- Static Package Attributes inherited from iText.Barcodes.Barcode2D
const float  DEFAULT_MODULE_SIZE = 1
 

Detailed Description

A Data Matrix is a two-dimensional bar code consisting of black and white "cells" or dots arranged in either a square or rectangular pattern, also known as a matrix.

A Data Matrix is a two-dimensional bar code consisting of black and white "cells" or dots arranged in either a square or rectangular pattern, also known as a matrix. The information to be encoded can be text or numeric data. Usual data size is from a few bytes up to 1556 bytes. The length of the encoded data depends on the number of cells in the matrix.

Constructor & Destructor Documentation

◆ BarcodeDataMatrix() [1/3]

iText.Barcodes.BarcodeDataMatrix.BarcodeDataMatrix ( )
inline

Creates an instance of this class.

◆ BarcodeDataMatrix() [2/3]

iText.Barcodes.BarcodeDataMatrix.BarcodeDataMatrix ( String  code )
inline

Creates an instance of BarcodeDataMatrix

Parameters
code the code to generate. It should be noted that all characters will be encoded using the default encoding, ISO-8859-1

◆ BarcodeDataMatrix() [3/3]

iText.Barcodes.BarcodeDataMatrix.BarcodeDataMatrix ( String  code,
String  encoding 
)
inline

Creates an instance of BarcodeDataMatrix

Parameters
code the code to generate.
encoding the encoding to use when generating the barcode

Member Function Documentation

◆ CreateFormXObject() [1/2]

virtual PdfFormXObject iText.Barcodes.BarcodeDataMatrix.CreateFormXObject ( Color  foreground,
float  moduleSide,
PdfDocument  document 
)
inlinevirtual

Creates a PdfFormXObject with the barcode with given module width and module height.

Parameters
foreground The color of the pixels. It can be null
moduleSide The side (width and height) of the pixels.
document The document
Returns
the XObject.

◆ CreateFormXObject() [2/2]

override PdfFormXObject iText.Barcodes.BarcodeDataMatrix.CreateFormXObject ( Color  foreground,
PdfDocument  document 
)
inlinevirtual

Creates a PdfFormXObject with the barcode.

Implements iText.Barcodes.Barcode2D.

◆ GetBarcodeSize() [1/2]

override Rectangle iText.Barcodes.BarcodeDataMatrix.GetBarcodeSize ( )
inlinevirtual

Gets the maximum area that the barcode and the text, if any, will occupy.

Implements iText.Barcodes.Barcode2D.

◆ GetBarcodeSize() [2/2]

virtual Rectangle iText.Barcodes.BarcodeDataMatrix.GetBarcodeSize ( float  moduleHeight,
float  moduleWidth 
)
inlinevirtual

Gets the barcode size

Parameters
moduleHeight The height of the module
moduleWidth The width of the module
Returns
The size of the barcode

◆ GetEncoding()

virtual String iText.Barcodes.BarcodeDataMatrix.GetEncoding ( )
inlinevirtual

getting encoding for data matrix code

Returns
encoding for data matrix code

◆ GetHeight()

virtual int iText.Barcodes.BarcodeDataMatrix.GetHeight ( )
inlinevirtual

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.

Returns
the height of the barcode

◆ GetOptions()

virtual int iText.Barcodes.BarcodeDataMatrix.GetOptions ( )
inlinevirtual

Gets the barcode options.

Returns
the barcode options

◆ GetWidth()

virtual int iText.Barcodes.BarcodeDataMatrix.GetWidth ( )
inlinevirtual

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.

Returns
the width of the barcode

◆ GetWs()

virtual int iText.Barcodes.BarcodeDataMatrix.GetWs ( )
inlinevirtual

Gets the whitespace border around the barcode.

Returns
the whitespace border around the barcode

◆ PlaceBarcode() [1/2]

override Rectangle iText.Barcodes.BarcodeDataMatrix.PlaceBarcode ( PdfCanvas  canvas,
Color  foreground 
)
inlinevirtual

Places the barcode in a PdfCanvas.

Implements iText.Barcodes.Barcode2D.

◆ PlaceBarcode() [2/2]

virtual Rectangle iText.Barcodes.BarcodeDataMatrix.PlaceBarcode ( PdfCanvas  canvas,
Color  foreground,
float  moduleSide 
)
inlinevirtual

Places the barcode in a PdfCanvas

Parameters
canvas the canvas to place the barcode on
foreground The foreground color of the barcode
moduleSide The side (width and height) of the pixels.
Returns
the dimensions the barcode occupies

◆ SetCode() [1/2]

virtual int iText.Barcodes.BarcodeDataMatrix.SetCode ( byte[]  text,
int  textOffset,
int  textSize 
)
inlinevirtual

Creates a barcode.

Parameters
text the text
textOffset the offset to the start of the text
textSize the text size
Returns
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.

◆ SetCode() [2/2]

virtual int iText.Barcodes.BarcodeDataMatrix.SetCode ( String  text )
inlinevirtual

Creates a barcode.

Creates a barcode. The String is interpreted with the ISO-8859-1 encoding

Parameters
text the text
Returns
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.

◆ SetEncoding()

virtual void iText.Barcodes.BarcodeDataMatrix.SetEncoding ( String  encoding )
inlinevirtual

setting encoding for data matrix code ( default encoding iso-8859-1)

Parameters
encoding encoding for data matrix code

◆ SetHeight()

virtual void iText.Barcodes.BarcodeDataMatrix.SetHeight ( int  height )
inlinevirtual

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

Parameters
height the height of the barcode

◆ SetOptions()

virtual void iText.Barcodes.BarcodeDataMatrix.SetOptions ( int  options )
inlinevirtual

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.

Parameters
options the barcode options

◆ SetWidth()

virtual void iText.Barcodes.BarcodeDataMatrix.SetWidth ( int  width )
inlinevirtual

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

Parameters
width the width of the barcode

◆ SetWs()

virtual void iText.Barcodes.BarcodeDataMatrix.SetWs ( int  ws )
inlinevirtual

Sets the whitespace border around the barcode.

Parameters
ws the whitespace border around the barcode

Member Data Documentation

◆ DM_ASCII

const int iText.Barcodes.BarcodeDataMatrix.DM_ASCII = 1
static

ASCII encodation.

◆ DM_AUTO

const int iText.Barcodes.BarcodeDataMatrix.DM_AUTO = 0
static

The best encodation will be used.

◆ DM_B256

const int iText.Barcodes.BarcodeDataMatrix.DM_B256 = 4
static

Binary encodation.

◆ DM_C40

const int iText.Barcodes.BarcodeDataMatrix.DM_C40 = 2
static

C40 encodation.

◆ DM_EDIFACT

const int iText.Barcodes.BarcodeDataMatrix.DM_EDIFACT = 6
static

EDIFACT encodation.

◆ DM_ERROR_EXTENSION

const int iText.Barcodes.BarcodeDataMatrix.DM_ERROR_EXTENSION = 5
static

An error while parsing an extension.

◆ DM_ERROR_INVALID_SQUARE

const int iText.Barcodes.BarcodeDataMatrix.DM_ERROR_INVALID_SQUARE = 3
static

The dimensions given for the symbol are illegal.

◆ DM_ERROR_TEXT_TOO_BIG

const int iText.Barcodes.BarcodeDataMatrix.DM_ERROR_TEXT_TOO_BIG = 1
static

The text is too big for the symbology capabilities.

◆ DM_EXTENSION

const int iText.Barcodes.BarcodeDataMatrix.DM_EXTENSION = 32
static

Allows extensions to be embedded at the start of the text.

◆ DM_NO_ERROR

const int iText.Barcodes.BarcodeDataMatrix.DM_NO_ERROR = 0
static

No error.

◆ DM_RAW

const int iText.Barcodes.BarcodeDataMatrix.DM_RAW = 7
static

No encodation needed.

No encodation needed. The bytes provided are already encoded.

◆ DM_TEST

const int iText.Barcodes.BarcodeDataMatrix.DM_TEST = 64
static

Doesn't generate the image but returns all the other information.

◆ DM_TEXT

const int iText.Barcodes.BarcodeDataMatrix.DM_TEXT = 3
static

TEXT encodation.

◆ DM_X12

const int iText.Barcodes.BarcodeDataMatrix.DM_X12 = 5
static

X12 encodation.