Table of Contents

Class DataMatrix

Namespace
PDFjet.NET
Assembly
PDFjet.dll

Used to create 2D Data Matrix barcodes: ECC 200 symbols as specified in ISO/IEC 16022. The text is encoded as UTF-8 in the smallest symbol that holds it. Please see Example_37.

public class DataMatrix : IDrawable
Inheritance
DataMatrix
Implements
Inherited Members

Constructors

DataMatrix(string)

Creates a square Data Matrix barcode.

public DataMatrix(string str)

Parameters

str string

DataMatrix(string, int)

Creates a Data Matrix barcode with the shape DataMatrix.SQUARE or DataMatrix.RECTANGLE. Throws an ArgumentException if the text does not fit in the largest symbol.

public DataMatrix(string str, int shape)

Parameters

str string
shape int

Fields

RECTANGLE

Rectangular symbols, from 8x18 to 16x48 modules. Data that does not fit in a rectangular symbol gets a square symbol.

public static readonly int RECTANGLE

Field Value

int

SQUARE

Square symbols, from 10x10 to 144x144 modules.

public static readonly int SQUARE

Field Value

int

Methods

DrawOn(Page)

Draws this barcode on the specified page. With no page nothing is drawn. Returns the x and y coordinates of the bottom right corner of this barcode. The brush of the page is as it was after it.

public float[] DrawOn(Page page)

Parameters

page Page

Returns

float[]

FromGS1(string)

Creates a square GS1 DataMatrix barcode, as medicines, medical devices and, more and more, retail goods carry. The data is written as people read it: each Application Identifier in parentheses and its data after it, such as "(01)09506000134352(17)261231(10)ABC123". The symbol starts with FNC1, which says it is GS1, and a field of no set length is ended with GS when another follows. Throws an ArgumentException if the data is not GS1: an Application Identifier that is not two to four digits, or with no data; a character GS1 does not allow, a parenthesis among them; data longer than 90 characters; data of a field of set length, such as the GTIN of (01) or the date of (17), that is not that many digits; or a wrong check digit of an SSCC (00), a GTIN (01) or (02), or a GLN (410) to (417). Also if the data does not fit in the largest symbol.

public static DataMatrix FromGS1(string str)

Parameters

str string

Returns

DataMatrix

FromGS1(string, int)

Creates a GS1 DataMatrix barcode with the shape DataMatrix.SQUARE or DataMatrix.RECTANGLE. See FromGS1(String).

public static DataMatrix FromGS1(string str, int shape)

Parameters

str string
shape int

Returns

DataMatrix

GetModules()

Returns the modules of this barcode, by row and column; true is dark.

public bool[][] GetModules()

Returns

bool[][]

SetAltDescription(string)

Sets what the barcode says for a screen reader: a tagged document, PDF/UA or a PDF/A of level A, then has the barcode as a figure of that description. Without one, its modules are decoration, which a screen reader skips.

public DataMatrix SetAltDescription(string altDescription)

Parameters

altDescription string

the description.

Returns

DataMatrix

this DataMatrix object.

SetLocation(float, float)

Sets the location of the top left corner of this barcode.

public DataMatrix SetLocation(float x, float y)

Parameters

x float
y float

Returns

DataMatrix

SetModuleColor(int)

Sets the color of the barcode as a 0xRRGGBB value.

public DataMatrix SetModuleColor(int color)

Parameters

color int

Returns

DataMatrix

SetModuleLength(float)

Sets the module length of this barcode. The default value is 2.0f. Leave a margin of at least one module around the barcode.

public DataMatrix SetModuleLength(float moduleLength)

Parameters

moduleLength float

Returns

DataMatrix