package datamatrix

import "github.com/edragoev1/pdfjet/v9/src/datamatrix"

Package datamatrix creates Data Matrix barcodes.

Index

Constants

const (
	// Square selects the square symbols, from 10x10 to 144x144 modules.
	Square = 0
	// Rectangle selects the rectangular symbols, from 8x18 to 16x48 modules.
	// Data that does not fit in a rectangular symbol gets a square symbol.
	Rectangle = 1
)

Types

type DataMatrix

type DataMatrix struct {
	// contains filtered or unexported fields
}

DataMatrix is 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.

func NewDataMatrix
func NewDataMatrix(str string) *DataMatrix

NewDataMatrix creates a square Data Matrix barcode. It panics if the text does not fit in the largest symbol.

func NewDataMatrixWithShape
func NewDataMatrixWithShape(str string, shape int) *DataMatrix

NewDataMatrixWithShape creates a Data Matrix barcode with the shape Square or Rectangle. It panics if the text does not fit in the largest symbol.

func NewGS1DataMatrix
func NewGS1DataMatrix(str string) *DataMatrix

NewGS1DataMatrix 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. It panics 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). It panics too if the data does not fit in the largest symbol.

func NewGS1DataMatrixWithShape
func NewGS1DataMatrixWithShape(str string, shape int) *DataMatrix

NewGS1DataMatrixWithShape creates a GS1 DataMatrix barcode with the shape Square or Rectangle. See NewGS1DataMatrix.

func (*DataMatrix) DrawOn
func (dm *DataMatrix) DrawOn(page *pdfjet.Page) [2]float32

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

func (*DataMatrix) GetModules
func (dm *DataMatrix) GetModules() [][]bool

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

func (*DataMatrix) SetAltDescription
func (dm *DataMatrix) SetAltDescription(altDescription string) *DataMatrix

SetAltDescription 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.

func (*DataMatrix) SetLocation
func (dm *DataMatrix) SetLocation(x, y float32) pdfjet.Drawable

SetLocation sets the location of the top left corner of this barcode.

func (*DataMatrix) SetModuleColor
func (dm *DataMatrix) SetModuleColor(color int32) *DataMatrix

SetModuleColor sets the color of the barcode as a 0xRRGGBB value.

func (*DataMatrix) SetModuleLength
func (dm *DataMatrix) SetModuleLength(moduleLength float32) *DataMatrix

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