Documentation ¶
Overview ¶
stolen and modified from https://github.com/mugli/png2escpos
Index ¶
- Constants
- Variables
- func FromUTF8(to string, s []byte) ([]byte, error)
- type Escpos
- func (e *Escpos) BarcodeHeight(p uint8) (int, error)
- func (e *Escpos) BarcodeWidth(p uint8) (int, error)
- func (e *Escpos) Bold(p bool) *Escpos
- func (e *Escpos) CODE39(code string) (int, error)
- func (e *Escpos) Cut() (int, error)
- func (e *Escpos) DefaultLineSpacing() (int, error)
- func (e *Escpos) EAN13(code string) (int, error)
- func (e *Escpos) EAN8(code string) (int, error)
- func (e *Escpos) HRIFont(p bool) (int, error)
- func (e *Escpos) HRIPosition(p uint8) (int, error)
- func (e *Escpos) Initialize() (int, error)
- func (e *Escpos) Justify(p uint8) *Escpos
- func (e *Escpos) LineFeed() (int, error)
- func (e *Escpos) LineFeedD(p uint8) (int, error)
- func (e *Escpos) LineSpacing(p uint8) (int, error)
- func (e *Escpos) MotionUnits(x, y uint8) (int, error)
- func (e *Escpos) Print() error
- func (e *Escpos) PrintAndCut() error
- func (e *Escpos) PrintImage(image image.Image) (int, error)
- func (e *Escpos) PrintNVBitImage(p uint8, mode uint8) (int, error)
- func (e *Escpos) QRCode(code string, model bool, size uint8, correctionLevel uint8) (int, error)
- func (e *Escpos) Reverse(p bool) *Escpos
- func (e *Escpos) Rotate(p bool) *Escpos
- func (e *Escpos) SetConfig(conf PrinterConfig)
- func (e *Escpos) Size(width uint8, height uint8) *Escpos
- func (e *Escpos) UPCA(code string) (int, error)
- func (e *Escpos) UPCE(code string) (int, error)
- func (e *Escpos) Underline(p uint8) *Escpos
- func (e *Escpos) UpsideDown(p bool) *Escpos
- func (e *Escpos) Write(data string) (int, error)
- func (e *Escpos) WriteGBK(data string) (int, error)
- func (e *Escpos) WriteRaw(data []byte) (int, error)
- func (e *Escpos) WriteWEU(data string) (int, error)
- type PrinterConfig
- type Style
Constants ¶
Variables ¶
var ( ConfigEpsonTMT20II = PrinterConfig{} ConfigEpsonTMT88II = PrinterConfig{DisableUpsideDown: true} ConfigSOL802 = PrinterConfig{DisableUpsideDown: true} )
Functions ¶
Types ¶
type Escpos ¶
type Escpos struct { Style Style // contains filtered or unexported fields }
func (*Escpos) BarcodeHeight ¶
Sets the height for a bar code. Default is 162.
func (*Escpos) BarcodeWidth ¶
Sets the horizontal size for a bar code. Default is 3. Must be between 2 and 6
func (*Escpos) Cut ¶
Feeds the paper to the end and performs a Cut. In the ESC/POS Command Manual there is also PartialCut and FullCut documented, but it does exactly the same.
func (*Escpos) DefaultLineSpacing ¶
Sets the line spacing to the default. According to command manual this is 1/6 inch
func (*Escpos) EAN13 ¶
Prints a EAN13 Barcode. code can only be numerical characters and must have a length of 12 or 13
func (*Escpos) EAN8 ¶
Prints a EAN8 Barcode. code can only be numerical characters and must have a length of 7 or 8
func (*Escpos) HRIPosition ¶
Sets the position of the HRI characters 0: Not Printed 1: Above the bar code 2: Below the bar code 3: Both
func (*Escpos) Initialize ¶
Initializes the printer to the settings it had when turned on
func (*Escpos) Justify ¶
Sets the justification of the text. Possible values are 0, 1 or 2. You can use JustifyLeft for left alignment JustifyCenter for center alignment JustifyRight for right alignment
func (*Escpos) LineFeedD ¶
According to command manual this prints and feeds the paper p*line spacing.
func (*Escpos) LineSpacing ¶
Sets the line spacing to multiples of the "horizontal and vertical motion units".. Those can be set with MotionUnits
func (*Escpos) MotionUnits ¶
Sets the horizontal (x) and vertical (y) motion units to 1/x inch and 1/y inch. Well... According to the manual anyway. You may not want to use this, as it does not seem to do the same on an Epson TM-20II
func (*Escpos) PrintAndCut ¶
Sends the buffered data to the printer and performs a cut
func (*Escpos) PrintImage ¶
Prints an image
func (*Escpos) PrintNVBitImage ¶
Print a predefined bit image with index p and mode mode
func (*Escpos) QRCode ¶
Prints a QR Code. code specifies the data to be printed model specifies the qr code model. false for model 1, true for model 2 size specifies the size in dots. It needs to be between 1 and 16
func (*Escpos) Reverse ¶
Sets Reverse printing. If true the printer will inverse to white text on black background.
func (*Escpos) Size ¶
Sets the size of the font. Width and Height should be between 0 and 5. If the value is bigger than 5, 5 is used.
func (*Escpos) UPCA ¶
Prints a UPCA Barcode. code can only be numerical characters and must have a length of 11 or 12
func (*Escpos) UPCE ¶
Prints a UPCE Barcode. code can only be numerical characters and must have a length of 11 or 12
func (*Escpos) Underline ¶
Sets the Underline. p can be 0, 1 or 2. It defines the thickness of the underline in dots