Git Product home page Git Product logo

blue_print_pos's Introduction

Introduction

This plugin to help use bluetooth printer in Android/iOS. Support for text, image, add new line or line dashed and QR.

Usage

Initialize

BluePrintPos bluePrintPos = BluePrintPos.instance; 

Scan bluetooth printer

bluePrintPos.scan();

Connect bluetooth printer

bluePrintPos.connect(device);

Print Text

In method .addText(text, {size, style, alignment}) you can modify size, style and alignment

ReceiptSectionText receiptText = ReceiptSectionText();
receiptText.addText('MY STORE', size: ReceiptTextSizeType.medium, style: ReceiptTextStyleType.bold);

Print text left right

receiptText.addLeftRightText('Time', '04/06/21, 10:00');

Print image

final ByteData logoBytes = await rootBundle.load('assets/logo.jpg');
receiptText.addImage(
  base64.encode(Uint8List.view(logoBytes.buffer)),
  width: 150,
);

Add new line

receiptText.addSpacer();

Add new line with dash

receiptText.addSpacer(useDashed: true);

Batch Printing

await bluePrintPos.printReceiptText(
  receipt,
  batchPrintOptions: const BatchPrintOptions.perNContent(20),
);

Getting Started

Android

Change the minSdkVersion in android/app/build.gradle in 19

android {
  defaultConfig {
     minSdkVersion 19
  }
}

Add permission for Bluetooth and access location in android/app/src/main/AndroidManifest.xml

<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>

iOS

Add info key in ios/Runner/Info.plist

<key>NSBluetoothAlwaysUsageDescription</key>  
<string>Need BLE permission</string>  
<key>NSBluetoothPeripheralUsageDescription</key>  
<string>Need BLE permission</string>  
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>  
<string>Need Location permission</string>  
<key>NSLocationAlwaysUsageDescription</key>  
<string>Need Location permission</string>  
<key>NSLocationWhenInUseUsageDescription</key>  
<string>Need Location permission</string>

Thanks to

Reference and dependencies create this plugin

blue_print_pos's People

Contributors

samaddev avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.