Documentation ¶
Index ¶
- Constants
- Variables
- type Printer
- func (p *Printer) Barcode(barcode string, format int)
- func (p *Printer) Cash()
- func (p *Printer) CloseConnection() error
- func (p *Printer) Cut()
- func (p *Printer) End()
- func (p *Printer) Feed(params map[string]string) error
- func (p *Printer) FeedAndCut(params map[string]string)
- func (p *Printer) Formfeed()
- func (p *Printer) FormfeedN(n int)
- func (p *Printer) Image(params map[string]string, data string) error
- func (p *Printer) Init()
- func (p *Printer) Linefeed()
- func (p *Printer) PrintImage(imgPath string) error
- func (p *Printer) PrintTextImage(text string) error
- func (p *Printer) Pulse()
- func (p *Printer) Raster(width, height, lineWidth int, imgBw []byte, printingType string)
- func (p *Printer) ReadStatus() bool
- func (p *Printer) Reset()
- func (p *Printer) SendEmphasize()
- func (p *Printer) SendFontSize()
- func (p *Printer) SendMoveX(x uint16)
- func (p *Printer) SendMoveY(y uint16)
- func (p *Printer) SendReverse()
- func (p *Printer) SendRotate()
- func (p *Printer) SendSmooth()
- func (p *Printer) SendUnderline()
- func (p *Printer) SendUpsidedown()
- func (p *Printer) SetAlign(align string)
- func (p *Printer) SetDPI(resolution float64)
- func (p *Printer) SetEmphasize(u byte)
- func (p *Printer) SetFont(font string)
- func (p *Printer) SetFontFile(filepath string)
- func (p *Printer) SetFontSize(width, height byte)
- func (p *Printer) SetFontSizePoints(fontSize float64)
- func (p *Printer) SetHinting(hintingVal string)
- func (p *Printer) SetImageHight(hight int)
- func (p *Printer) SetLang(lang string)
- func (p *Printer) SetReverse(v byte)
- func (p *Printer) SetRotate(v byte)
- func (p *Printer) SetSmooth(v byte)
- func (p *Printer) SetSpacing(spacingVal float64)
- func (p *Printer) SetUnderline(v byte)
- func (p *Printer) SetUpsidedown(v byte)
- func (p *Printer) SetWhiteOnBlack(wonbVal bool)
- func (p *Printer) Text(params map[string]string, text string) error
- func (p *Printer) TextToRaster(text string, fontSize float64, wb bool) (data []byte, width int, height int, err error)
- func (p *Printer) Write(buf []byte) (int, error)
- func (p *Printer) WriteNode(name string, params map[string]string, data string)
- func (p *Printer) WriteString(s string) (int, error)
- type Server
- type ServerOption
Constants ¶
const (
// DefaultEndpoint is the default server endpoint for ePOS printers.
DefaultEndpoint = "/cgi-bin/epos/service.cgi"
)
Variables ¶
var ( // ErrBodyElementEmpty is the body element empty error. ErrBodyElementEmpty = errors.New("Body element empty") )
Functions ¶
This section is empty.
Types ¶
type Printer ¶
Printer wraps sending ESC-POS commands to a io.Writer.
func NewPrinter ¶
func NewPrinter(w io.ReadWriter) (*Printer, error)
NewPrinter creates a new printer using the specified writer.
func (*Printer) CloseConnection ¶
func (*Printer) FeedAndCut ¶
FeedAndCut feeds the printer using the supplied params and then sends a cut command.
func (*Printer) Init ¶
func (p *Printer) Init()
Init resets the state of the printer, and writes the initialize code.
func (*Printer) PrintImage ¶
PrintImage Print Image
func (*Printer) PrintTextImage ¶
PrintTextImage takes a string convert it to an image and print it
func (*Printer) Pulse ¶
func (p *Printer) Pulse()
Pulse sends the pulse (open drawer) code to the printer.
func (*Printer) Raster ¶
Raster writes a rasterized version of a black and white image to the printer with the specified width, height, and lineWidth bytes per line.
func (*Printer) ReadStatus ¶
func (*Printer) SendEmphasize ¶
func (p *Printer) SendEmphasize()
SendEmphasize sends the emphasize / doublestrike command to the printer.
func (*Printer) SendFontSize ¶
func (p *Printer) SendFontSize()
SendFontSize sends the font size command to the printer.
func (*Printer) SendReverse ¶
func (p *Printer) SendReverse()
SendReverse sends the reverse command to the printer.
func (*Printer) SendRotate ¶
func (p *Printer) SendRotate()
SendRotate sends the rotate command to the printer.
func (*Printer) SendSmooth ¶
func (p *Printer) SendSmooth()
SendSmooth sends the smooth command to the printer.
func (*Printer) SendUnderline ¶
func (p *Printer) SendUnderline()
SendUnderline sends the underline command to the printer.
func (*Printer) SendUpsidedown ¶
func (p *Printer) SendUpsidedown()
SendUpsidedown sends the upsidedown command to the printer.
func (*Printer) SetEmphasize ¶
SetEmphasize sets the emphasize state and sends it to the printer.
func (*Printer) SetFontFile ¶
SetFontFile to choose a certien font to print the image with
func (*Printer) SetFontSize ¶
SetFontSize sets the font size state and sends the command to the printer.
func (*Printer) SetFontSizePoints ¶
SetFontSizePoint sets font size in points for some selected font
func (*Printer) SetHinting ¶
SetHinting sets hinting
func (*Printer) SetImageHight ¶
func (*Printer) SetReverse ¶
SetReverse sets the reverse state and sends it to the printer.
func (*Printer) SetSpacing ¶
SetSpacing set spacing between lines in image
func (*Printer) SetUnderline ¶
SetUnderline sets the underline state and sends it to the printer.
func (*Printer) SetUpsidedown ¶
SetUpsidedown sets the upsidedown state and sends it to the printer.
func (*Printer) SetWhiteOnBlack ¶
SetWhiteOnBlack sets the background for the image to white for true or black for false
func (*Printer) Text ¶
Text sends a block of text to the printer using the formatting parameters in params.
func (*Printer) TextToRaster ¶
func (p *Printer) TextToRaster(text string, fontSize float64, wb bool) (data []byte, width int, height int, err error)
TextToRaster takes a string, font size, boolean value if true will print text black background white if false will print text white background black return slice bytes of raster image with width and height
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server wrap
func NewServer ¶
func NewServer(w io.ReadWriter, opts ...ServerOption) (*Server, error)
NewServer creates a new ePOS server.
type ServerOption ¶
ServerOption is a server option.
func WithLog ¶
func WithLog(f func(string, ...interface{})) ServerOption
WithLog is a server option to set a logging func.