escpos

package
v0.0.0-...-723bbbf Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2025 License: 0BSD Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FlagNone  = 0
	FlagDebug = 1 << 0
)

Variables

View Source
var (
	CharPage0 = Encoding{
				// contains filtered or unexported fields
	}
	CharPagePC427          = CharPage0
	CharPageUSA            = CharPage0
	CharPageStandardEurope = CharPage0

	CharPage1 = Encoding{
				// contains filtered or unexported fields
	}
	CharPageKatakana = CharPage1

	CharPage2 = Encoding{
				// contains filtered or unexported fields
	}
	CharPagePC850        = CharPage2
	CharPageMultilingual = CharPage2

	CharPage3 = Encoding{
				// contains filtered or unexported fields
	}
	CharPagePC860      = CharPage3
	CharPagePortuguese = CharPage3

	CharPage4 = Encoding{
				// contains filtered or unexported fields
	}
	CharPagePC863          = CharPage4
	CharPageCanadianFrench = CharPage4

	CharPage5 = Encoding{
				// contains filtered or unexported fields
	}
	CharPagePC865  = CharPage5
	CharPageNordic = CharPage5

	CharPage6 = Encoding{
				// contains filtered or unexported fields
	}
	CharPageHirakana         = CharPage6
	CharPageSimplifiedKanji1 = CharPage6

	CharPage7 = Encoding{
				// contains filtered or unexported fields
	}
	CharPageSimplifiedKanji2 = CharPage7

	CharPage8 = Encoding{
				// contains filtered or unexported fields
	}
	CharPageSimplifiedKanji3 = CharPage8

	CharPage16 = Encoding{
				// contains filtered or unexported fields
	}
	CharPageWPC1252 = CharPage16

	CharPage17 = Encoding{
				// contains filtered or unexported fields
	}
	CharPagePC866     = CharPage17
	CharPageCyrillic2 = CharPage17

	CharPage18 = Encoding{
				// contains filtered or unexported fields
	}
	CharPageLatin2 = CharPage18

	CharPage19 = Encoding{
				// contains filtered or unexported fields
	}
	CharPageEuro = CharPage19

	CharPage254 = Encoding{
				// contains filtered or unexported fields
	}

	CharPage255 = Encoding{
				// contains filtered or unexported fields
	}
)

Functions

This section is empty.

Types

type Component

type Component interface {
	String() string
	// contains filtered or unexported methods
}
var Nil Component = nilComponent{}

func AltFont

func AltFont(children ...Component) Component

func Big

func Big(children ...Component) Component

func Bold

func Bold(children ...Component) Component

func CanonicalComponent

func CanonicalComponent(component Component) Component

func Group

func Group(children ...Component) Component

func Normal

func Normal(children ...Component) Component

func Tall

func Tall(children ...Component) Component

func Text

func Text(text string) Component

Text returns a Component that will print utf8-encoded text in an automatically chosen encoding. It will automatically switch between encodings mid-sentence if needed. The Component will return an error if the printer any part of the input string could not be converted.

Text uses libc iconv to convert the text. Both musl libc and glibc are supported.

func Underline

func Underline(children ...Component) Component

func Wide

func Wide(children ...Component) Component

type Dimensions

type Dimensions struct {
	// The width of the printable area, in dots
	PrintWidth int
	// The dimensions of the fonts available on the printer. Index 0 is font A,
	// index 1 is font B, etc.
	Fonts []FontDimensions
}

type Encoding

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

type FontDimensions

type FontDimensions struct {
	// The width of a single character, in dots
	Width int
	// The height of a single character, in dots
	Height int
}

type IOError

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

func (*IOError) Error

func (err *IOError) Error() string

func (*IOError) Unwrap

func (err *IOError) Unwrap() error

type ImageFlags

type ImageFlags int
const (
	// Print the image without doing any processing. Will cause ugly results
	// unless the image was made with the printer in mind.
	ImageUnprocessed ImageFlags = 0
	// Automatically resize the image to the width of the print paper
	ImageResize ImageFlags = 1 << iota
	// Dither the image using an unspecified algoritm.
	ImageDither
	// Automatically rotate the image if doing so increases quality. Only
	// effective if ImageResize is set.
	ImageAutoRotate
)

type LineDirtyError

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

LineDirtyError is returned when the action cannot be performed because the printer needs to be in the "begining of the line" state for action to be performed, but it has been determined that the printer won't be in this state when it will process the command.

This usually happens when character data is written to the printer without a linefeed ('\n') at the end.

func (*LineDirtyError) Error

func (err *LineDirtyError) Error() string

type Printer

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

func StartPrinter

func StartPrinter(printer printer.Printer, proto protocol.Protocol) (*Printer, error)

func StartUSBPrinter

func StartUSBPrinter(path string, proto protocol.Protocol, flags int) (*Printer, error)

func (*Printer) ASBStatus

func (p *Printer) ASBStatus() <-chan protocol.ASBStatus

func (*Printer) Close

func (p *Printer) Close() error

func (*Printer) CutPaper

func (p *Printer) CutPaper() error

func (*Printer) Dimensions

func (p *Printer) Dimensions() Dimensions

Dimensions returns several dimensions about the printer. All values are zero when using a generic printer.

func (*Printer) DisableASB

func (p *Printer) DisableASB() error

func (*Printer) EnableASB

func (p *Printer) EnableASB(flags int) error

func (*Printer) Print

func (p *Printer) Print(components ...Component) error

func (*Printer) PrintImage

func (p *Printer) PrintImage(img image.Image, flags ImageFlags) error

func (*Printer) SetPrintSpeed

func (p *Printer) SetPrintSpeed(speed int) error

func (*Printer) Wait

func (p *Printer) Wait() error

func (*Printer) Write

func (p *Printer) Write(data []byte) (int, error)

func (*Printer) WriteString

func (p *Printer) WriteString(s string) (n int, err error)

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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