GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - ReMatter/escpos: golang library for espos printers, supporting images, barcodes and qr codes

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

16 Commits
16 Commits

Folders and files

NameName
Last commit message
Last commit date
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
Readme.md
Readme.md
 
 
bitimage.go
bitimage.go
 
 
configs.go
configs.go
 
 
go.mod
go.mod
 
 
go.sum
go.sum
 
 
main.go
main.go
 
 

Repository files navigation

About escpos GoDoc

FOSSA Status Go Reference

This is a Golang package that provides ESC-POS library functions to help with sending control codes to a ESC-POS thermal printer.

It was largely inspired by seer-robotics/escpos but is a complete rewrite.

It implements the protocol described in this Command Manual

Current featureset

  • Initializing the Printer
  • Toggling Underline mode
  • Toggling Bold text
  • Toggling upside-down character printing
  • Toggling Reverse mode
  • Linespace settings
  • Rotated characters
  • Align text
  • Default ASCII Charset, Western Europe and GBK encoding
  • Character size settings
  • UPC-A, UPC-E, EAN13, EAN8 Barcodes
  • QR Codes
  • Standard printing mode
  • Image Printing
  • Printing of predefined NV images

Installation

Install the package via the following:

go get -u github.com/hennedo/escpos

Usage

The escpos package can be used as the following:

package main

import (
	"github.com/hennedo/escpos"
	"net"
)

func main() {
	socket, err := net.Dial("tcp", "192.168.8.40:9100")
	if err != nil {
		println(err.Error())
	}
	defer socket.Close()

	p := escpos.New(socket)
	p.SetConfig(escpos.ConfigEpsonTMT20II)

	p.Bold(true).Size(2, 2).Write("Hello World")
	p.LineFeed()
	p.Bold(false).Underline(2).Justify(escpos.JustifyCenter).Write("this is underlined")
	p.LineFeed()
	p.QRCode("https://github.com/hennedo/escpos", true, 10, escpos.QRCodeErrorCorrectionLevelH)



	// You need to use either p.Print() or p.PrintAndCut() at the end to send the data to the printer.
	p.PrintAndCut()
}

Disable features

As the library sets all the styling parameters again for each call of Write, you might run into compatibility issues. Therefore it is possible to deactivate features. To do so, use a predefined config (available for all printers listed under Compatibility) right after the escpos.New call

p := escpos.New(socket)
p.SetConfig(escpos.ConfigEpsonTMT20II) // predefined config for the Epson TM-T20II

// or for example

p.SetConfig(escpos.PrinterConfig(DisableUnderline: true))

Compatibility

This is a (not complete) list of supported and tested devices.

Manufacturer Model Styling Barcodes QR Codes Images
Epson TM-T20II ✅ ✅ ✅ ✅
Epson TM-T88II ☑️
UpsideDown Printing not supported
✅ ✅

License

FOSSA Status

About

golang library for espos printers, supporting images, barcodes and qr codes

Resources

Readme
License
Activity
Custom properties

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.