cpcl_esc_printer 0.2.0 copy "cpcl_esc_printer: ^0.2.0" to clipboard
cpcl_esc_printer: ^0.2.0 copied to clipboard

Flutter BLE thermal printer plugin with CPCL / ESC-POS / TSPL builders — text, barcode, QR, tables, images, plus optional Material scan/debug UI.

0.2.0 #

  • Add TsplBuilder — a TSPL / TSPL2 (TSC) label command builder: SIZE / GAP / BLINE / DIRECTION / DENSITY / SPEED / CODEPAGE setup, text, barcode (14 symbologies), qrcode, box / bar / hLine / vLine, image (BITMAP, byte-inverted so MonoBitmap 1=black maps correctly), paper controls (feed / backFeed / formFeed / home), sound, cut, cls, raw / rawLine escape hatches, and build({copies, sets}). Text is routed through the pluggable TextEncoder (GBK for Chinese); lines use CRLF.

0.1.1 #

  • Docs: use absolute GitHub URLs for the language switch link and sponsor images so they render on pub.flutter-io.cn (relative paths only worked on GitHub).

0.1.0 #

Initial release.

Connectivity #

  • BLE connect / disconnect / auto-reconnect built on flutter_blue_plus 1.36.8 (the last BSD-3 / free release before the 2.0.0 commercial-license switch). Supports Android / iOS / macOS / Linux / Web.
  • MTU-aware chunking: writeRaw chunks using the connection's negotiated MTU (Android ~512, iOS/macOS ~135-255) with a fixed fallback — big speedup for image / long-label printing. PrinterProfile.autoMtu (default true) and PrinterManager.negotiatedMtu.
  • Per-print completion detection via the notify characteristic (fixed-delay fallback when no notify characteristic is present). Serialised write queue so multi-label jobs never interleave.

Command builders #

  • CpclBuilder — CPCL label commands: text / font sizes, bold, magnify, rotation, justify, underline, inverseLine, pattern, contrast, speed, serialCount, pageWidth, beep, cut, gap/bar sensing (gapSense / barSense / barSenseLeft), charSpacing, encoding/country, scaleText, barcodes (UPCA / EAN / CODE39 / 93 / 128 / CODABAR / ITF / … + vertical), QR / pdf417 / datamatrix, HRI text, prefeed/postfeed, pace/wait, watermark (background/bkText), reprint, multi-font concat and multiline, graphics/image (EG bitmap) and a bordered grid table(). (lineSpacing is deprecated — SETSP is character spacing; use charSpacing.)
  • EscBuilder — ESC/POS receipt commands: text, alignment, font sizes, positioning (absolutePosition / relativePosition / leftMargin / printAreaWidth), printMode, reverse, rotate90, upsideDown, doubleStrike, selectFont, charSpacing, Chinese modes, code tables, codePage (GBK / Big5), barcode config + generalized barcode (GS k function B), barcode128, QR code (qrcode and qrcodeGsk), columns, monospace table(), raster/image/imageBitImage (GS v 0 and ESC * 33 modes), cut/cutGsV, black-mark feeds (feedToRightMark/feedToLeftMark), cashDrawer/realtimeDrawerPulse, buzzer, page mode (pageMode / standardMode / pageArea / pageDirection / printPage / pageAbsoluteVertical / pageRelativeVertical), peripheral/panel controls (selectPeripheral / panelKeys / chineseCodeFormat / userDefinedCharset / cancelUserChar), and status queries (realtimeStatus DLE EOT / transmitStatus GS r / realtimeRequest / autoStatusBack / transmitId / deviceStatus with DeviceStatus.parse — replies on the notify characteristic).
  • Escape hatches for vendor-specific commands: CpclBuilder.raw / rawLine and EscBuilder.raw / rawText — wrap your own chainable helpers via a Dart extension. Builders are transport-agnostic: build() bytes can be sent over BLE, classic SPP, USB, etc.
  • Pluggable TextEncoder (defaults to UTF-8; plug in GBK for Chinese printers).
  • Dependency-free MonoBitmap (RGBA / grayscale → 1-bit, optional Floyd–Steinberg dithering). PNG/JPG decoding is delegated to the optional image package, not depended on.

Configuration & UI #

  • PrinterProfile — configurable service / write / notify UUIDs with a built-in generic (Nordic-UART) preset and autoDetect. Vendor-specific characteristics are handled via the debug page's live picker rather than shipped presets. Tunables: autoMtu, mtu, chunkDelayMs, printTimeoutMs, fallbackDelayMs, writeWithoutResponse.
  • PrinterManager singleton exposing scan/connect/write plus negotiatedMtu, connectedDeviceId / connectedDeviceName, and the resolved boundServiceUuid / boundWriteUuid / boundNotifyUuid (no flutter_blue_plus types leaked to callers).
  • Optional Material PrinterScannerPage and PrinterDebugPage (decoupled from GetX / flustars / smart_dialog). The debug page lists services/characteristics, lets you pick and apply the write/notify pair live, copies UUIDs, and prints font / label / receipt / image samples.
  • Example app demonstrating runtime permissions (permission_handler) and persistence + auto-reconnect (shared_preferences) — both example-only; the plugin itself depends only on flutter_blue_plus.
1
likes
140
points
136
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Flutter BLE thermal printer plugin with CPCL / ESC-POS / TSPL builders — text, barcode, QR, tables, images, plus optional Material scan/debug UI.

Repository (GitHub)
View/report issues

Topics

#bluetooth #thermal-printer #esc-pos #cpcl #tspl

License

MIT (license)

Dependencies

flutter, flutter_blue_plus

More

Packages that depend on cpcl_esc_printer