Documentation
¶
Index ¶
- Constants
- Variables
- type Component
- func AltFont(children ...Component) Component
- func Big(children ...Component) Component
- func Bold(children ...Component) Component
- func CanonicalComponent(component Component) Component
- func Group(children ...Component) Component
- func Normal(children ...Component) Component
- func Tall(children ...Component) Component
- func Text(text string) Component
- func Underline(children ...Component) Component
- func Wide(children ...Component) Component
- type Dimensions
- type Encoding
- type FontDimensions
- type IOError
- type ImageFlags
- type LineDirtyError
- type Printer
- func (p *Printer) ASBStatus() <-chan protocol.ASBStatus
- func (p *Printer) Close() error
- func (p *Printer) CutPaper() error
- func (p *Printer) Dimensions() Dimensions
- func (p *Printer) DisableASB() error
- func (p *Printer) EnableASB(flags int) error
- func (p *Printer) Print(components ...Component) error
- func (p *Printer) PrintImage(img image.Image, flags ImageFlags) error
- func (p *Printer) SetPrintSpeed(speed int) error
- func (p *Printer) Wait() error
- func (p *Printer) Write(data []byte) (int, error)
- func (p *Printer) WriteString(s string) (n int, err error)
Constants ¶
const ( FlagNone = 0 FlagDebug = 1 << 0 )
Variables ¶
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 CanonicalComponent ¶
func Text ¶
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.
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 FontDimensions ¶
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 StartUSBPrinter ¶
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 (*Printer) PrintImage ¶
func (p *Printer) PrintImage(img image.Image, flags ImageFlags) error