datamatrix

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 13, 2026 License: Apache-2.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package datamatrix encodes ISO/IEC 16022:2024 ECC 200 logical symbols.

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidInput = errors.New("datamatrix: invalid input")

ErrInvalidInput reports invalid Data Matrix payloads and options.

Functions

This section is empty.

Types

type Macro

type Macro uint8

Macro selects a Data Matrix Macro 05 or Macro 06 control header.

const (
	// MacroNone encodes ordinary Data Matrix data.
	MacroNone Macro = iota
	// Macro05 emits the ISO/IEC 16022 Macro 05 control codeword.
	Macro05
	// Macro06 emits the ISO/IEC 16022 Macro 06 control codeword.
	Macro06
)

type Options

type Options struct {
	Shape            Shape
	QuietZone        int
	MinWidth         int
	MinHeight        int
	MaxWidth         int
	MaxHeight        int
	GS1              bool
	ECI              int
	Macro            Macro
	StructuredAppend *StructuredAppend
}

Options controls Data Matrix shape, dimensions, and quiet zone.

type Shape

type Shape uint8

Shape constrains Data Matrix ECC 200 symbol geometry.

const (
	// Automatic and the other constants select Data Matrix shape constraints.
	Automatic Shape = iota
	// Square forces a square Data Matrix symbol.
	Square
	// Rectangle forces a rectangular Data Matrix symbol.
	Rectangle
)

type StructuredAppend

type StructuredAppend struct {
	Index  int
	Total  int
	FileID byte
}

StructuredAppend identifies one part of a two-to-sixteen-symbol sequence.

type Symbol

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

Symbol combines an immutable logical symbol with Data Matrix metadata.

func Encode

func Encode(payload []byte, options Options) (Symbol, error)

Encode returns an ECC 200 logical matrix with a one-module quiet zone by default. Dimension constraints refer to the symbol before its quiet zone.

func EncodeGS1

func EncodeGS1(elements gs1.ElementString, options Options) (Symbol, error)

EncodeGS1 serializes validated GS1 elements and emits first-position FNC1.

func (Symbol) ECI

func (symbol Symbol) ECI() int

ECI returns the requested ECI assignment, or zero when absent.

func (Symbol) GS1

func (symbol Symbol) GS1() bool

GS1 reports whether the symbol begins with the FNC1 control codeword.

func (Symbol) Logical

func (symbol Symbol) Logical() barcode.Symbol

Logical returns the immutable format-neutral symbol.

func (Symbol) Macro

func (symbol Symbol) Macro() Macro

Macro returns the requested Macro 05 or Macro 06 control block.

func (Symbol) Shape

func (symbol Symbol) Shape() Shape

Shape returns the requested Data Matrix shape constraint.

func (Symbol) StructuredAppend

func (symbol Symbol) StructuredAppend() (StructuredAppend, bool)

StructuredAppend returns a defensive copy of the sequence header.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL