Easy Thermal Print

A Flutter package for easy thermal printing. It provides a simple API that lets you print text, or custom widgets to a thermal printer. The package currently supports Bluetooth Low Energy (BLE) printers and is thus compatible with all platforms that support BLE.

Features

  • ✅ Print text and custom widgets to thermal printers.
  • ✅ Support for Bluetooth Low Energy (BLE) printers.
  • ✅ customizable print settings:
    • Label Size / continuous paper
    • optional half-tone printing (░▒█)
    • Text styling
  • ✅ dry run mode for testing without a printer
  • ✅ view print output via PrintedViewer widget

Supported Devices

  • out-of-the-box support for:
  • support for other BLE thermal via config (feel free to reach out, so we can add it to the included list)

Example

Example Screenshot

Usage

  1. import the package:

    flutter pub add easy_thermal_print
    
  2. initialize the Bluetooth service and discover devices

    /// create a new instance of the BluetoothService.
    /// provide a list of printers to scan for.
    final bluetoothService = BluetoothPrintersService(
    printers: [...phomemoPrinters],
    );
    
    /// ⚠️ make sure the user grants the permissions before scanning
    bluetoothService.discover();
    // devices will appear in: bluetoothService.connectedPrinters
    
  3. start printing 🎉

    printer.printWidget( // or printText
        containerKey,
        PrintConfig(halfTones: true,labelSize: Size(60, 12)),
    );
    
    • make sure to wrap the stuff you want to print in a Printable widget

Required Permissions

Android

Add the following permissions to your AndroidManifest.xml:

    ...
    <uses-feature android:name="android.hardware.bluetooth_le" android:required="false" />
    <uses-permission android:name="android.permission.BLUETOOTH_SCAN" android:usesPermissionFlags="neverForLocation" />
    <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
</manifest>
iOS / macOS

Add the following keys to your Release/Debug.entitlements:

    ...
    <key>com.apple.security.device.bluetooth</key>
	<true/>
  </dict>
</plist>

Project Acknowledgements:

  • phomemo-tools for details regarding the printing protocol
  • phomemo for the setup for printing widgets to an image



Have a great day,
Yours, Robin

"donate"