You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Printing works fine now after I added more flush calls to the writers because before it would not print the whole text.
However, I can not get the cut function to work.
My code:
funcprintReceipt(contentstring) error {
lines:=strings.Split(content, "\n")
// Open the file of the printerprinterFile, err:=os.OpenFile("/dev/usb/lp0", os.O_RDWR, 0)
iferr!=nil {
returnerr
}
deferprinterFile.Close()
// Initialize the printerreader:=bufio.NewReader(printerFile)
writer:=bufio.NewWriter(printerFile)
readWriter:=bufio.NewReadWriter(reader, writer)
printer:=escpos.New(readWriter)
printer.Init()
printer.SetFontSize(1, 1)
// Write the content and cut the paperfor_, line:=rangelines {
printer.Write(line+"\n")
readWriter.Flush()
writer.Flush()
}
printer.FormfeedN(6)
printer.Cut()
writer.Flush()
readWriter.Flush()
printer.End()
returnnil
}
Activity