printer

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2026 License: EUPL-1.2 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrPrinterNotFound = errors.New("printer not found")

Functions

func IsShiny

func IsShiny() bool

func RenderTicket

func RenderTicket(p *escposlib.Escpos, ticket Ticket, la Layout) error

func SplitIntoLines

func SplitIntoLines(text string, charsPerLine, maxLines int) []string

Types

type Description

type Description struct {
	Justify             string `json:"justify"`
	Size                int    `json:"size"`
	LinesAllwaysVisible int    `json:"linesAllwaysVisible"`
	MaxLines            int    `json:"maxLines"`
	Enabled             bool   `json:"enabled"`
	Bold                bool   `json:"bold"`
}
type Footer struct {
	Justify string `json:"justify"`
	Size    int    `json:"size"`
	Enabled bool   `json:"enabled"`
	Bold    bool   `json:"bold"`
}
type Header struct {
	Justify string `json:"justify"`
	Size    int    `json:"size"`
	Style   int    `json:"style"`
	Enabled bool   `json:"enabled"`
	Bold    bool   `json:"bold"`
}

type Layout

type Layout struct {
	QR                 QR          `json:"qr"`
	ShinyHint          ShinyHint   `json:"shinyHint"`
	Footer             Footer      `json:"footer"`
	CutCommand         string      `json:"cutCommand"`
	Header             Header      `json:"header"`
	Tag                Tag         `json:"tag"`
	Title              Title       `json:"title"`
	Description        Description `json:"description"`
	PaperWidth         int         `json:"paperWidth"`
	CharsPerLine       int         `json:"charsPerLine"`
	FeedLinesBeforeCut int         `json:"feedLinesBeforeCut"`
}

type NoopPrinter

type NoopPrinter struct{}

func (NoopPrinter) PrintTicket

func (NoopPrinter) PrintTicket(ctx context.Context, ticket Ticket) error

type Printer

type Printer interface {
	PrintTicket(ctx context.Context, ticket Ticket) error
}

func NewFromConfig

func NewFromConfig(cfg config.Config) (Printer, error)

type QR

type QR struct {
	Justify    string `json:"justify"`
	Correction string `json:"correction"`
	Size       int    `json:"size"`
	Enabled    bool   `json:"enabled"`
}

type ShinyHint

type ShinyHint struct {
	Justify string `json:"justify"`
	Size    int    `json:"size"`
	Enabled bool   `json:"enabled"`
	Bold    bool   `json:"bold"`
}

type Tag

type Tag struct {
	Justify string `json:"justify"`
	Size    int    `json:"size"`
	Style   int    `json:"style"`
	Enabled bool   `json:"enabled"`
	Bold    bool   `json:"bold"`
}

type Ticket

type Ticket struct {
	CreatedAt   time.Time
	DueAt       *time.Time
	Title       string
	Description string
	Tag         string
	QRValue     string
	DisplayName string
	TaskID      int64
	UserID      int64
	Shiny       bool
}

type Title

type Title struct {
	Justify             string `json:"justify"`
	Size                int    `json:"size"`
	LinesAllwaysVisible int    `json:"linesAllwaysVisible"`
	MaxLines            int    `json:"maxLines"`
	Bold                bool   `json:"bold"`
}

type USBPrinter

type USBPrinter struct {
	Layout         Layout
	EndpointNumber int

	VendorID  gousb.ID
	ProductID gousb.ID
	// contains filtered or unexported fields
}

func NewUSBPrinter

func NewUSBPrinter(vendorID, productID uint16, endpointNumber int, layout Layout) *USBPrinter

func (*USBPrinter) PrintTicket

func (p *USBPrinter) PrintTicket(ctx context.Context, ticket Ticket) error

Jump to

Keyboard shortcuts

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