escpos

package
v0.0.0-...-b444c55 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2016 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// BAUDRATE Though most of these printers are factory configured for 19200 baud
	// operation, a few rare specimens instead work at 9600.  If so, change
	// this constant.  This will NOT make printing slower!  The physical
	// print and feed mechanisms are the bottleneck, not the port speed.
	BAUDRATE = 19200

	// BYTETIME Number of microseconds to issue one byte to the printer.  11 bits
	// (not 8) to accommodate idle, start and stop bits.  Idle time might
	// be unnecessary, but erring on side of caution here.
	BYTETIME = (((11 * 1000000) + (BAUDRATE / 2)) / BAUDRATE)

	// ASCIILF -> \n
	ASCIILF = byte(10)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Escpos

type Escpos struct {

	// destination
	// dst io.Writer
	// config *serial.Config
	Serial *serial.Port

	Verbose  bool
	Debug    bool
	Firmware int
	// contains filtered or unexported fields
}

Escpos - library for the Adafruit Thermal Printer: https://www.adafruit.com/product/597

func New

func New(debug bool, port string, baud int) (e *Escpos)

New - create Escpos printer

func (*Escpos) BarCode

func (e *Escpos) BarCode(code string, data string)

BarCode print barcode

func (*Escpos) BarcodeChr

func (e *Escpos) BarcodeChr(val uint8)

BarcodeChr - 1:Abovebarcode 2:Below 3:Both 0:Not printed

func (*Escpos) Begin

func (e *Escpos) Begin()

Begin - The printer can't start receiving data immediately upon power up -- it needs a moment to cold boot and initialize. Allow at least 1/2 sec of uptime before printer can receive data. func (e *Escpos) Begin(heatTime uint8) {

func (*Escpos) Cash

func (e *Escpos) Cash()

Cash - send cash

func (*Escpos) Cut

func (e *Escpos) Cut()

Cut - send cut

func (*Escpos) DoubleHeight

func (e *Escpos) DoubleHeight(state bool)

DoubleHeight - set double height

func (*Escpos) End

func (e *Escpos) End()

End output

func (*Escpos) Feed

func (e *Escpos) Feed(n int)

Feed - send N feeds

func (*Escpos) FeedAndCut

func (e *Escpos) FeedAndCut(params map[string]string)

FeedAndCut - feed and cut based on parameters

func (*Escpos) Flush

func (e *Escpos) Flush()

Flush - set \f

func (*Escpos) FormFeed

func (e *Escpos) FormFeed()

FormFeed - send formfeed

func (*Escpos) Image

func (e *Escpos) Image(params map[string]string, data string)

Image - write an image

func (*Escpos) Init

func (e *Escpos) Init()

Init - init/reset printer settings

func (*Escpos) IsOk

func (e *Escpos) IsOk() bool

IsOk - check error

func (*Escpos) LinePrint

func (e *Escpos) LinePrint()

LinePrint - print line -------

func (*Escpos) Linefeed

func (e *Escpos) Linefeed()

Linefeed - send linefeed

func (*Escpos) Pulse

func (e *Escpos) Pulse()

Pulse - pulse (open the drawer)

func (*Escpos) SendEmphasize

func (e *Escpos) SendEmphasize()

SendEmphasize - send emphasize / doublestrike

func (*Escpos) SendFontSize

func (e *Escpos) SendFontSize()

SendFontSize -

func (*Escpos) SendMoveX

func (e *Escpos) SendMoveX(x uint16)

SendMoveX - send move x

func (*Escpos) SendMoveY

func (e *Escpos) SendMoveY(y uint16)

SendMoveY - send move y

func (*Escpos) SendReverse

func (e *Escpos) SendReverse()

SendReverse - send reverse

func (*Escpos) SendRotate

func (e *Escpos) SendRotate()

SendRotate - send rotate

func (*Escpos) SendSmooth

func (e *Escpos) SendSmooth()

SendSmooth - send smooth

func (*Escpos) SendUnderline

func (e *Escpos) SendUnderline()

SendUnderline - send underline

func (*Escpos) SendUpsidedown

func (e *Escpos) SendUpsidedown()

SendUpsidedown - send upsidedown

func (*Escpos) SetAlign

func (e *Escpos) SetAlign(align string) (err error)

SetAlign - set alignment align (left, center, right)

func (*Escpos) SetBold

func (e *Escpos) SetBold(state bool)

SetBold - bold mode true/false

func (*Escpos) SetCharset

func (e *Escpos) SetCharset(val uint8)

SetCharset - Alters some chars in ASCII 0x23-0x7E range; see datasheet

func (*Escpos) SetCodePage

func (e *Escpos) SetCodePage(code string)

SetCodePage - Selects alt symbols for 'upper' ASCII values 0x80-0xFF

func (*Escpos) SetDefault

func (e *Escpos) SetDefault()

func (*Escpos) SetEmphasize

func (e *Escpos) SetEmphasize(u uint8)

SetEmphasize - set emphasize

func (*Escpos) SetFont

func (e *Escpos) SetFont(font string)

SetFont - set font

func (*Escpos) SetFontSize

func (e *Escpos) SetFontSize(name string)

SetFontSize - set font size large/medium/normal

func (*Escpos) SetLang

func (e *Escpos) SetLang(lang string)

SetLang - set language -- ESC R

func (*Escpos) SetReverse

func (e *Escpos) SetReverse(v uint8)

SetReverse - set reverse

func (*Escpos) SetRotate

func (e *Escpos) SetRotate(v uint8)

SetRotate - set rotate

func (*Escpos) SetSmall

func (e *Escpos) SetSmall(state bool)

SetSmall - set small font true/false

func (*Escpos) SetSmooth

func (e *Escpos) SetSmooth(v uint8)

SetSmooth - set smooth

func (*Escpos) SetUnderline

func (e *Escpos) SetUnderline(v uint8)

SetUnderline - set underline

func (*Escpos) SetUpsidedown

func (e *Escpos) SetUpsidedown(v uint8)

SetUpsidedown - set upsidedown

func (*Escpos) TestPage

func (e *Escpos) TestPage()

TestPage - print test page

func (*Escpos) Text

func (e *Escpos) Text(params map[string]string, data string)

Text - do a block of text

func (*Escpos) Write

func (e *Escpos) Write(data string) (int, error)

Write - write a string to the printer

func (*Escpos) WriteBytes

func (e *Escpos) WriteBytes(data []byte)

WriteBytes - write byte

func (*Escpos) WriteNode

func (e *Escpos) WriteNode(data []models.Printer, set *models.BarCodeOption)

WriteNode write a "node" to the printer

func (*Escpos) WriteRaw

func (e *Escpos) WriteRaw(data []byte) (n int, err error)

WriteRaw - write raw bytes to printer

func (*Escpos) WriteText

func (e *Escpos) WriteText(data string) (err error)

WriteText - The underlying method for all high-level printing (e.g. println()). The inherited Print class handles the rest!

Jump to

Keyboard shortcuts

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