escpos

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 3, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AlignCenter

func AlignCenter() []byte

AlignCenter sets center alignment

func AlignLeft

func AlignLeft() []byte

AlignLeft sets left alignment

func BoldOff

func BoldOff() []byte

BoldOff disables bold text

func BoldOn

func BoldOn() []byte

BoldOn enables bold text

func ConvertImageToESCPOS

func ConvertImageToESCPOS(imagePath string, thresholdPercent int) ([]byte, error)

ConvertImageToESCPOS converts an image file to ESC/POS bitmap format threshold is a percentage (0-100, higher = more black pixels)

func Cut

func Cut() []byte

Cut cuts the paper

func DoubleHeight

func DoubleHeight() []byte

DoubleHeight sets double height only

func DoubleSize

func DoubleSize() []byte

DoubleSize sets double width and height

func DoubleWidth

func DoubleWidth() []byte

DoubleWidth sets double width only

func Feed

func Feed(n int) []byte

Feed feeds n lines

func GenerateDataMatrix

func GenerateDataMatrix(data string) []byte

GenerateDataMatrix generates a DataMatrix 2D barcode using ESC/POS commands

func GenerateEAN13

func GenerateEAN13(code string) []byte

GenerateEAN13 generates an EAN-13 barcode using native ESC/POS barcode commands The data should be exactly 12 or 13 digits. If 12 digits, the check digit is calculated automatically by the printer.

func GeneratePDF417

func GeneratePDF417(data string) []byte

GeneratePDF417 generates a PDF417 2D barcode using ESC/POS commands

func GenerateQRCode

func GenerateQRCode(data string) []byte

GenerateQRCode generates a QR code and converts it to ESC/POS bitmap format

func Init

func Init() []byte

Init initializes the printer

func LineFeed

func LineFeed() []byte

LineFeed sends a line feed with carriage return (newline + return to column 0)

func NormalSize

func NormalSize() []byte

NormalSize resets to normal text size

func SendToPrinter

func SendToPrinter(data []byte, printerName string) error

SendToPrinter sends ESC/POS data to the specified printer via lpr

func SolidLine

func SolidLine(widthPixels int) []byte

SolidLine generates a solid line bitmap

func UnderlineOff

func UnderlineOff() []byte

UnderlineOff disables underline

func UnderlineOn

func UnderlineOn() []byte

UnderlineOn enables underline

func WriteToFile added in v1.1.0

func WriteToFile(data []byte, path string) error

WriteToFile writes raw ESC/POS data to the given path. This is the export path used instead of SendToPrinter when CUPS/lpr is unavailable (e.g. Windows).

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL