elements

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const StoredGraphicsDefaultPath = "R:UNKNOWN.GRF"

Variables

This section is empty.

Functions

This section is empty.

Types

type Barcode128

type Barcode128 struct {
	// The bar code orientation to use.
	// Valid values are N (no rotation), R (rotate 90° clockwise), I (rotate 180° clockwise), and B (rotate 270° clockwise).
	// The default value is the orientation configured via the ^FW command, which itself defaults to N (no rotation).
	Orientation FieldOrientation
	// The bar code height, in dots.
	// Any number between 1 and 32,000 may be used.
	// The default value is the bar code height configured via the ^BY command, which itself defaults to 10.
	Height int
	// Whether or not to include human-readable text with the bar code.
	// Valid values are Y and N.
	// The default value is Y (include human-readable text).
	Line bool
	// Whether or not to place the human-readable text above the bar code.
	// Valid values are Y and N.
	// The default value is N (if printed, text is placed below the bar code),
	// except for mode U where the default is Y (if printed, text is placed above the bar code).
	LineAbove bool
	// Whether or not to calculate a GS1 (UCC) Mod 10 check digit.
	// Valid values are Y and N.
	// The default value is N (GS1 check digit is not calculated).
	// TODO: Figure out if it should be implemented, as it's part of the interface but reference libraries disregard this value.
	CheckDigit bool
	// The mode to use to encode the bar code data.
	// Valid values are N (no mode, subsets are specified explicitly as part of the field data),
	// U (UCC case mode, field data must contain 19 digits),
	// A (automatic mode, the ZPL engine automatically determines the subsets that are used to encode the data),
	// and D (UCC/EAN mode, field data must contain GS1 numbers).
	// The default value is N (no mode, subsets are specified explicitly as part of the field data).
	Mode BarcodeMode
}

type Barcode128WithData

type Barcode128WithData struct {
	Barcode128
	Width    int
	Position LabelPosition
	Data     string
}

type BarcodeAztec added in v1.1.0

type BarcodeAztec struct {
	// The bar code orientation to use.
	// Valid values are N (no rotation),
	// R (rotate 90° clockwise),
	// I (rotate 180° clockwise), and B (rotate 270° clockwise).
	// The default value is the orientation configured via the ^FW command, which itself defaults to N (no rotation).
	Orientation FieldOrientation

	// The bar code magnification to use.
	// Any number between 1 and 10 may be used.
	// The default value depends on the print density being used.
	Magnification int

	// The Aztec bar code size to use.
	// Valid values are 101-104 (compact Aztec code sizes),
	// 201-232 (full-range Aztec code sizes),
	// 300 (Aztec runes),
	// and 1-99 (dynamic sizing for a specific minimum error correction percentage).
	// By default, the bar code is sized dynamically to fit the encoded data.
	Size int
}

type BarcodeAztecWithData added in v1.1.0

type BarcodeAztecWithData struct {
	BarcodeAztec
	Position LabelPosition
	Data     string
}

type BarcodeDimensions

type BarcodeDimensions struct {
	ModuleWidth int
	Height      int
}

type BarcodeMode

type BarcodeMode int
const (
	BarcodeModeNormal    BarcodeMode = 0
	BarcodeModeUcc       BarcodeMode = 1
	BarcodeModeAutomatic BarcodeMode = 2
	BarcodeModeEan       BarcodeMode = 3
)

type BarcodePdf417

type BarcodePdf417 struct {
	// The bar code orientation to use.
	// Valid values are N (no rotation),
	// R (rotate 90° clockwise),
	// I (rotate 180° clockwise), and B (rotate 270° clockwise).
	// The default value is the orientation configured via the ^FW command, which itself defaults to N (no rotation).
	Orientation FieldOrientation

	// The bar code row height, in dots.
	// Any number between 1 and the label height may be used.
	// The default value is the row height necessary for the total bar code height
	// to match the bar code height configured via the ^BY command.
	RowHeight int

	// The level of error correction to apply.
	// Any number between 0 and 8 may be used.
	// The higher the number, the larger the generated bar code and the more resilient it is to scan errors.
	// The default value is 0 (scan errors are detected but not corrected).
	Security int

	// The number of data columns to encode.
	// Any number between 1 and 30 may be used.
	// This parameter can be used to control the bar code width.
	// The default value depends on the amount of data encoded.
	Columns int

	// The number of rows to encode.
	// Any number between 3 and 90 may be used.
	// This parameter can be used to control the bar code height.
	// The default value depends on the amount of data encoded.
	Rows int

	// Whether or not to generate a truncated PDF417 bar code, also known as compact PDF417.
	// Truncated PDF417 bar codes are narrower because they do not include right row indicators,
	// but should only be used when label damage is unlikely. Valid values are Y and N.
	// The default value is N (do not truncate).
	Truncate bool
}

type BarcodePdf417WithData

type BarcodePdf417WithData struct {
	BarcodePdf417
	Position LabelPosition
	Data     string
}

type FieldBlock

type FieldBlock struct {
	// The maximum text block width, in dots.
	// Text longer than this width is wrapped to another line.
	// Any number between 0 and 9,999 may be used. The default value is 0, which is rarely useful.
	MaxWidth int

	// The maximum number of text lines to allow.
	// If the text does not fit on the specified number of lines, any remaining text is drawn over the previous text on the last line.
	// Any number between 1 and 9,999 may be used. The default value is 1.
	MaxLines int

	// Extra spacing to add between lines, in dots.
	// Positive numbers increase the distance between lines, negative numbers decrease the distance between lines.
	// Any number between -9,999 and 9,999 may be used. The default value is 0.
	LineSpacing int

	// The text alignment to apply to the text block.
	// Valid values are L (left), R (right), C (center) and J (justified).
	// The default value is L (left).
	Alignment TextAlignment

	// The hanging indent to apply to all lines except the first line, in dots.
	// Any number between 0 and 9,999 may be used. The default value is 0.
	HangingIndent int
}

type FieldOrientation

type FieldOrientation int
const (
	// no rotation
	FieldOrientationNormal FieldOrientation = 0
	// rotate 90° clockwise
	FieldOrientation90 FieldOrientation = 1
	// rotate 180° clockwise
	FieldOrientation180 FieldOrientation = 2
	// otate 270° clockwise
	FieldOrientation270 FieldOrientation = 3
)

func (FieldOrientation) GetDegrees

func (v FieldOrientation) GetDegrees() float64

type FontInfo

type FontInfo struct {
	Name        string
	Width       int
	Height      int
	Orientation FieldOrientation
}

type GraphicBox

type GraphicBox struct {
	Position        LabelPosition
	Width           int
	Height          int
	BorderThickness int
	CornerRounding  int
	LineColor       LineColor
	ReversePrint    bool
}

type GraphicCircle

type GraphicCircle struct {
	Position LabelPosition

	// The diameter of the circle, in dots.
	// Any number between 3 and 4,095 may be used.
	// The default value is 3.
	CircleDiameter int

	// The line thickness to use to draw the circle, in dots.
	// Any number between 1 and 4,095 may be used.
	// The default value is 1.
	BorderThickness int

	// The line color to use to draw the circle.
	// Valid values are B (black) and W (white).
	// The default value is B (black).
	LineColor LineColor
}

type GraphicField

type GraphicField struct {
	Position LabelPosition

	// The format of the image data contained in the fifth parameter.
	// Valid values are A (hexadecimal format), B (raw binary format), and C (AR compressed).
	// There is no default value.
	Format GraphicFieldFormat

	// The total number of data bytes in the fifth parameter.
	// The value of this parameter is always the same as totalBytes,
	// except in the case of format C (AR compressed) which is very rarely used.
	DataBytes int

	// The total number of bytes in the image.
	// Because each pixel in the image uses 1 bit, this value should be the total number of pixels in the image,
	// divided by 8 (since there are 8 bits per byte).
	// There is no default value.
	TotalBytes int

	// The number of bytes per pixel row in the image.
	// Because each pixel in the image uses 1 bit, this value should be the pixel width of the image,
	// divided by 8 (since there are 8 bits per byte).
	// There is no default value.
	RowBytes int

	// The image data, in the format specified in the first parameter.
	// There is no default value
	Data []byte

	// The horizontal magnification to apply to the image. Any number between 1 and 10 may be used. The default value is 1.
	MagnificationX int

	// The vertical magnification to apply to the image. Any number between 1 and 10 may be used. The default value is 1.
	MagnificationY int
}

type GraphicFieldFormat

type GraphicFieldFormat int
const (
	GraphicFieldFormatHex GraphicFieldFormat = 1
	GraphicFieldFormatRaw GraphicFieldFormat = 2
	GraphicFieldFormatAR  GraphicFieldFormat = 3
)

type LabelInfo

type LabelInfo struct {
	DownloadFormatName string
	Elements           []interface{}
}

type LabelPosition

type LabelPosition struct {
	X                   int
	Y                   int
	CalculateFromBottom bool
}

func (LabelPosition) Add

type LineColor

type LineColor int
const (
	LineColorBlack LineColor = 0
	LineColorWhite LineColor = 1
)

type Maxicode

type Maxicode struct {
	// The mode to use to encode the bar code data.
	// Valid values are 2 (numeric postal code),
	// 3 (alphanumeric postal code),
	// 4 (standard), 5 (full EEC), and 6 (reader programming).
	// The default value is 2 (numeric postal code).
	Mode int
}

type MaxicodeWithData

type MaxicodeWithData struct {
	Code     Maxicode
	Position LabelPosition
	Data     string
}

func (*MaxicodeWithData) GetInputData

func (barcode *MaxicodeWithData) GetInputData() (string, error)

type StoredGraphics

type StoredGraphics struct {
	// The image data, in hexadecimal format. There is no default value.
	Data []byte

	// The total number of bytes in the image.
	// Because each pixel in the image uses 1 bit, this value should be the total number of pixels in the image, divided by 8 (since there are 8 bits per byte).
	// There is no default value.
	TotalBytes int

	// The number of bytes per pixel row in the image.
	// Because each pixel in the image uses 1 bit, this value should be the pixel width of the image, divided by 8 (since there are 8 bits per byte).
	// The default value is 1, which is almost always incorrect.
	RowBytes int
}

type TextAlignment

type TextAlignment int
const (
	TextAlignmentLeft      TextAlignment = 0
	TextAlignmentRight     TextAlignment = 1
	TextAlignmentJustified TextAlignment = 2
	TextAlignmentCenter    TextAlignment = 3
)

type TextField

type TextField struct {
	Font         FontInfo
	Position     LabelPosition
	Orientation  FieldOrientation
	Alignment    TextAlignment
	Text         string
	Block        *FieldBlock
	ReversePrint bool
}

Jump to

Keyboard shortcuts

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