Documentation ¶
Index ¶
- Constants
- type Escpos
- func (e *Escpos) BarCode(code string, data string)
- func (e *Escpos) BarcodeChr(val uint8)
- func (e *Escpos) Begin()
- func (e *Escpos) Cash()
- func (e *Escpos) Cut()
- func (e *Escpos) DoubleHeight(state bool)
- func (e *Escpos) End()
- func (e *Escpos) Feed(n int)
- func (e *Escpos) FeedAndCut(params map[string]string)
- func (e *Escpos) Flush()
- func (e *Escpos) FormFeed()
- func (e *Escpos) Image(params map[string]string, data string)
- func (e *Escpos) Init()
- func (e *Escpos) IsOk() bool
- func (e *Escpos) LinePrint()
- func (e *Escpos) Linefeed()
- func (e *Escpos) Pulse()
- func (e *Escpos) SendEmphasize()
- func (e *Escpos) SendFontSize()
- func (e *Escpos) SendMoveX(x uint16)
- func (e *Escpos) SendMoveY(y uint16)
- func (e *Escpos) SendReverse()
- func (e *Escpos) SendRotate()
- func (e *Escpos) SendSmooth()
- func (e *Escpos) SendUnderline()
- func (e *Escpos) SendUpsidedown()
- func (e *Escpos) SetAlign(align string) (err error)
- func (e *Escpos) SetBold(state bool)
- func (e *Escpos) SetCharset(val uint8)
- func (e *Escpos) SetCodePage(code string)
- func (e *Escpos) SetDefault()
- func (e *Escpos) SetEmphasize(u uint8)
- func (e *Escpos) SetFont(font string)
- func (e *Escpos) SetFontSize(name string)
- func (e *Escpos) SetLang(lang string)
- func (e *Escpos) SetReverse(v uint8)
- func (e *Escpos) SetRotate(v uint8)
- func (e *Escpos) SetSmall(state bool)
- func (e *Escpos) SetSmooth(v uint8)
- func (e *Escpos) SetUnderline(v uint8)
- func (e *Escpos) SetUpsidedown(v uint8)
- func (e *Escpos) TestPage()
- func (e *Escpos) Text(params map[string]string, data string)
- func (e *Escpos) Write(data string) (int, error)
- func (e *Escpos) WriteBytes(data []byte)
- func (e *Escpos) WriteNode(data []models.Printer, set *models.BarCodeOption)
- func (e *Escpos) WriteRaw(data []byte) (n int, err error)
- func (e *Escpos) WriteText(data string) (err error)
Constants ¶
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 (*Escpos) BarcodeChr ¶
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) DoubleHeight ¶
DoubleHeight - set double height
func (*Escpos) FeedAndCut ¶
FeedAndCut - feed and cut based on parameters
func (*Escpos) SendEmphasize ¶
func (e *Escpos) SendEmphasize()
SendEmphasize - send emphasize / doublestrike
func (*Escpos) SetCharset ¶
SetCharset - Alters some chars in ASCII 0x23-0x7E range; see datasheet
func (*Escpos) SetCodePage ¶
SetCodePage - Selects alt symbols for 'upper' ASCII values 0x80-0xFF
func (*Escpos) SetDefault ¶
func (e *Escpos) SetDefault()
func (*Escpos) SetFontSize ¶
SetFontSize - set font size large/medium/normal
func (*Escpos) SetUpsidedown ¶
SetUpsidedown - set upsidedown
func (*Escpos) WriteNode ¶
func (e *Escpos) WriteNode(data []models.Printer, set *models.BarCodeOption)
WriteNode write a "node" to the printer