printer

package
v0.0.0-...-c3ab5a8 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2024 License: MIT Imports: 12 Imported by: 1

Documentation

Index

Constants

View Source
const (
	PrintWidth = 384
)

Variables

View Source
var DefaultFindOptions = FindOptions{}

DefaultFindOptions represents the default discovery options.

Functions

func PrepareImage

func PrepareImage(img image.Image, threshold bool) image.Image

PrepareImage prepares an image (scaling, thresholding, dithering) so that it can be passed to printer.Print().

Types

type FindOptions

type FindOptions struct {
	// bluetooth device name, ignored if empty
	Name string
	// HCI address, ignored if empty
	Address string
}

FindOptions represents options for device discovery.

type Printer

type Printer struct {
	// contains filtered or unexported fields
}

func Find

func Find(ctx context.Context, opts FindOptions) (*Printer, error)

Find finds a BLE printer and connects to it. Use ctx for timeout. Close() after usage.

func (*Printer) Close

func (p *Printer) Close()

Close closes the connection.

func (*Printer) Print

func (p *Printer) Print(ctx context.Context, img image.Image) error

Print prints an image. You may pass it through PrepareImage() beforehand.

Jump to

Keyboard shortcuts

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