패키지, 저장소 및 앱 카테고리 검색

GitHub 저장소FranciscoPV94/fp_bt_printer

fp_bt_printer

열식 프린터에 연결하고 데이터를 인쇄하는 패키지

fp_bt_printer 프로젝트 이미지
스타
4
포크
9
최근 푸시(UTC)
2023. 3. 31.
프로젝트 상태
활성

원본 README

아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.

fp_bt_printer

This library allows printing receipts on bluetooth thermal printers (android only). Support 58mm and 80mm printer.

It allows to print QR, BarCode, Images RasterImages with the esc_pos_utils package.

List bounded devices

Get list of bluetooth devices, it supports any version of bluetooth, not just BLE.

    List<PrinterDevice> devices = [];
    FpBtPrinter printer = FpBtPrinter();

    Future<void> getDevices() async {
        final response = await printer.scanBondedDevices();
        setState(() {
        devices = response;
        });
    }
Check device connected

You can check that the connection with the device is correct.

    Future<void> setConnet(PrinterDevice d) async {
        final response = await printer.checkConnection(d.address);
        print(response.message);
    }
Print data

This method recibe address of the printer and List of the data;

    FpBtPrinter printer = FpBtPrinter();
    final resp = await printer.printData(bytes, address: address);
    if (resp.success) {
     //print ok
    } else {
    print(resp.message); //print error
    }
Ticket with Styles usin :
List<int> getTicket() {
  final List<int> bytes = [];
  // Using default profile
  final profile = await CapabilityProfile.load();
    final generator = Generator(PaperSize.mm80, profile);
    List<int> bytes = [];

    // //  Print image:
    final ByteData data = await rootBundle.load('assets/wz.png');
    final Uint8List bytesImg = data.buffer.asUint8List();
    var image = decodePng(bytesImg);

    // resize
    var thumbnail =
        copyResize(image!, interpolation: Interpolation.nearest, height: 200);

    bytes += generator.text("fp_bt_printer",
        styles: PosStyles(align: PosAlign.center, bold: true));

    bytes += generator.imageRaster(thumbnail, align: PosAlign.center);

    bytes += generator.reset();
    bytes += generator.setGlobalCodeTable('CP1252');
    bytes += generator.feed(1);
    bytes += generator.text("HELLO PRINTER by FPV",
        styles: PosStyles(align: PosAlign.center, bold: true));
    bytes += generator.qrcode("https://github.com/FranciscoPV94",
        size: QRSize.Size6);
    bytes += generator.feed(1);
    bytes += generator.feed(1);

    final resp = await printer.printData(bytes, address: address);
  return bytes;
}

Tested and working with following Bluetooth Thermal Printers:

Xprinter Portable Thermal Printer

Model: Bixolon SPP-R310

Evidence

test receipt

Support me

If you think that this project has helped you with your developments, you can support this project, any support is much appreciated. Paypal

Francisco Peralta Vasquez GitHub avatar
GitHub 작성자

Francisco Peralta Vasquez ↗

Sistemas TicsonHermosillo Sonora, Mex공식 웹사이트 ↗
언어DartKotlin

이 저장소가 배포한 패키지

사용 중인 의존성

의존성 목록 3 개

프로젝트에 맞는 저장소를 선택하려면?

사용 목적에 따라 검색하고 개발 활동을 비교한 뒤 원본 저장소에서 요구 사항을 확인하세요.

  1. 이름, 작성자 또는 설명으로 검색하고 기술 주제로 범위를 좁힙니다.
  2. 스타, 포크, 최근 푸시를 함께 비교하세요. 스타는 관심의 지표이며 품질을 보장하지 않습니다.
  3. 사용하기 전에 GitHub에서 README, 라이선스, Issues를 확인하세요.

출처 및 관리

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗