Bluetooth Thermal Printer Integration

Portable Bluetooth thermal printers are used to generate the mini receipts.

Dependencies

bluetooth_thermal_printer

js

Printing receipts via Bluetooth thermal Printer

  • Enable the Bluetooth in the respective mobile device.

  • Switch the thermal printer.

  • Tap on the Print button from the respective screen if the printer device is connected already it will print the receipt directly or else it will show a dialog with a list of Bluetooth devices, from their user need to selected respective thermal printer, once device paired successfully it will generate a receipt in the printer.

Helper Methods

  • printTicket → Used to write the bytes to the thermal printer if device is connected otherwise it will show paired Bluetooth devices in a dialog.

    Required Arguments → bytes, context

  • getTicket → Used to generate the bytes from Image and also sets the papersize.
    Required Arguments → Image

  • showMyDialog → Used to show the Paired Bluetooth devices
    Required Arguments → bytes, context

  • setConnect → If device already connected it will generate the receipt or else it will show the paired devices to connect.

Files Path

https://github.com/misdwss/punjab-mgramseva/blob/master/frontend/mgramseva/lib/utils/common_printer.dart https://github.com/misdwss/punjab-mgramseva/blob/master/frontend/mgramseva/web/index.html