finds.dev← search

// the find

DantSu/ESCPOS-ThermalPrinter-Android

★ 1,528 · Java · MIT · updated May 2024

Useful library to help Android developpers to print with (Bluetooth, TCP, USB) ESC/POS thermal printer.

A Java Android library for printing to ESC/POS thermal printers over Bluetooth, TCP, or USB. It wraps the low-level ESC/POS byte protocol behind a simple markup-style text format, so you can write a receipt template with alignment tags and font sizes instead of manually constructing byte sequences. Aimed at Android devs building POS, receipt, or label printing into their apps.

The markup syntax ([L]/[C]/[R] columns, font sizes, barcode and QR tags) is genuinely easy to use — you can produce a decent-looking receipt in 20 lines without touching a single ESC/POS spec document. The three transport types share the same EscPosPrinter API, so swapping Bluetooth for TCP is a one-line change. Charset encoding is handled explicitly through EscPosCharsetEncoding, which is the right call given how many printers still live in Windows-1252 or JIS land. React Native, Cordova, and Flutter wrappers already exist, so the reach goes beyond pure Android.

The last commit was May 2024 and the library still targets Java instead of Kotlin, which is increasingly awkward in modern Android projects. The image path embeds the raw hex string directly in the print string, so printing a 256px logo means concatenating a multi-kilobyte hex blob inline — it works but it's clunky and the 256px height cap is a real limitation. There's no async API built into the library itself: TCP printing in the README example is wrapped in a raw Thread, which is the kind of thing that will crash your app if you call it on the main thread by mistake. Error handling surfaces as checked exceptions (EscPosConnectionException, EscPosBarcodeException, etc.) but there's no retry logic or connection state management — if the Bluetooth link drops mid-print, you're on your own.

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →