Version: v0.0.0-...-3832ca7 Latest Latest

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

Go to latest
Published: May 1, 2022 License: 0BSD Imports: 12 Imported by: 0



Package ql is a Linux driver for Brother QL-series printers.



View Source
const (
	StatusTypeReplyToRequest    StatusType = 0x00
	StatusTypePrintingCompleted            = 0x01
	StatusTypeErrorOccurred                = 0x02
	StatusTypeTurnedOff                    = 0x04
	StatusTypeNotification                 = 0x05
	StatusTypePhaseChange                  = 0x06


This section is empty.


This section is empty.


type MediaInfo

type MediaInfo struct {
	// Note that these are approximates, many pins within the margins will work.
	SideMarginPins int
	PrintAreaPins  int
	// If non-zero, length of the die-cut label print area in 300dpi pins.
	PrintAreaLength int

func GetMediaInfo

func GetMediaInfo(widthMM, lengthMM int) *MediaInfo

type Printer

type Printer struct {
	File         *os.File
	Manufacturer string
	Model        string

	LastStatus *Status
	MediaInfo  *MediaInfo

	// StatusNotify is called whenever we receive a status packet.
	StatusNotify func(*Status)

func Open

func Open() (*Printer, error)

Open finds and initializes the first USB printer found supporting the appropriate protocol. Returns nil if no printer could be found.

func (*Printer) Close

func (p *Printer) Close() error

Close closes the underlying file.

func (*Printer) Initialize

func (p *Printer) Initialize() error

Initialize initializes the printer for further operations.

func (*Printer) Print

func (p *Printer) Print(image image.Image, rb bool) error

func (*Printer) UpdateStatus

func (p *Printer) UpdateStatus() error

Request new status information from the printer. The printer must be in an appropriate mode, i.e. on-line and not currently printing.

type Status

type Status [32]byte

Status is a decoder for the status packed returned by the printer.

func (*Status) Dump

func (s *Status) Dump(f io.Writer)

Dump writes the status data to an io.Writer in a human-readable format.

func (*Status) Errors

func (s *Status) Errors() (errors []string)

func (*Status) MediaLengthMM

func (s *Status) MediaLengthMM() int

func (*Status) MediaWidthMM

func (s *Status) MediaWidthMM() int

func (*Status) Phase

func (s *Status) Phase() StatusPhase

func (*Status) String

func (s *Status) String() string

String implements the Stringer interface.

func (*Status) Type

func (s *Status) Type() StatusType

type StatusPhase

type StatusPhase byte
const (
	StatusPhaseReceiving StatusPhase = 0x00
	StatusPhasePrinting              = 0x01

type StatusType

type StatusType byte

Jump to

Keyboard shortcuts

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