Printers And Status
May 5, 2026 · View on GitHub
Printer Classes
BasePrinter: shared backend holder.GenericPrinter: full raster protocol implementation.P700,P750W:GenericPrinteraliases.H500: low-resolution-only variant (no half-cut support).E500,E550W: aliases forH500/P750W.
Print Lifecycle
GenericPrinter.print(job, options?) does:
- Validate job media/resolution support.
- Request pre-flight status and fail early on printer/media errors.
- Reset printer and send raster commands/page lines.
- Send final print command.
- Request post-print status and fail on late errors.
options.encodedPages can be provided to skip inline per-line compression:
encodedPages[i].linesshould contain prebuilt line payloads fromencodeLine(...).- When present, printer transmission uses those payloads directly.
Status requests use _requestStatus(...); for non-custom backends this sends ESC i S and parses a 32-byte response.
Status Object
new Status(data) parses:
errors(bit flags from two bytes)mediaWidth,mediaType, derivedmediamediaDetailsfor normalized loaded-media inspection, including unsupported cassette widths/typesstatus,notificationtapeColor,textColor
Helpers:
status.ready(): true when no error flags are set.status.media: resolved media profile viagetMedia(...).status.mediaDetails: normalized{ width, mediaType, mediaTypeName, mediaId, isKnown }details.
User-Facing Errors
Media and printer conditions are mapped to readable messages (for example media mismatch, no media, cover open, overheating).
Structured mismatch errors also expose:
error.code === PrinterErrorCode.MEDIA_MISMATCHerror.details.loadedMediaerror.details.expectedMedia
See printer-status-errors.md for the full message mapping.
Raster Helpers
encodeLine(bitmapLine, padding): packs one page line into protocol payload (PackBits-compressed and length-prefixed).