package main import ( "bufio" "fmt" "log" ) type Point struct { X, Y int } /* A4 Cutting area 5mm y 5mm +-----------------+ | | 5mm | +-------------+ | | | | | . . . . x . . . . . . . . | | | | | +-------------+ | | | | | 20mm +-----------------+ Default size: 20000, 4000 1000 pt == 50 mm A4: 210x297 mm => 4200x5940 Usable: 4000x5440 pt */ var ( A4 = Point{5440, 4000} // Portrait Origin = Point{0, 0} ) func (p Point) String() string { return fmt.Sprintf("%v,%v", p.X, p.Y) } type Cutter struct { *bufio.ReadWriter } func NewCutter(io *bufio.ReadWriter) Cutter { return Cutter{io} } func (c Cutter) EOT() { defer c.Flush() c.WriteByte(0x03) } func (c Cutter) TestCut() { defer c.EOT() c.WriteString("FH") } type StepDirection int const ( stepFinish StepDirection = 1<