zj_pos_printer 0.0.4 copy "zj_pos_printer: ^0.0.4" to clipboard
zj_pos_printer: ^0.0.4 copied to clipboard

PlatformAndroid

A Flutter plugin for ZJ-POS thermal printers via USB with support for formatting and CP860 accents.

zj_pos_printer #

A Flutter plugin for Android that provides a simple way to interface with ZJ-POS thermal printers via USB.

Features #

  • USB Connectivity: Easy connection with ZJ-6000 and similar thermal printers.
  • 🔠 Custom Formatting: Support for Bold, Alignment, and Text Sizes.
  • 🔳 QR Code Printing: Native ESC/POS QR Code printing support.
  • 🌍 International Support: Support for multiple Code Pages (CP860, CP850, etc.) for correct accents.
  • 🛠 Easy to use: Clean API with Enums for configuration.

Getting Started #

Add the package to your pubspec.yaml:

dependencies:
  zj_pos_printer: ^0.0.4

Android Setup #

Add the following permission to your android/app/src/main/AndroidManifest.xml:

<uses-feature android:name="android.hardware.usb.host" />

Usage #

Import the package:

import 'package:zj_pos_printer/zj_pos_printer.dart';

Connect to the printer before printing:

await ZjPosPrinter.connect();
await ZjPosPrinter.printText(
  'Pedido #123\n',
  bold: true,
  size: ZjTextSize.large,
  align: ZjAlignment.center,
);

await ZjPosPrinter.printText(
  'Cafe Expresso ....... R\$ 7,00\n',
  charset: ZjCharset.portuguese,
);
await ZjPosPrinter.printQrCode(
  'https://meusite.com/pedido/123',
  moduleSize: 6,
  errorCorrection: ZjQrErrorCorrection.medium,
  align: ZjAlignment.center,
);

Available options #

  • ZjAlignment.left, ZjAlignment.center, ZjAlignment.right
  • ZjTextSize.normal, ZjTextSize.large, ZjTextSize.extraLarge
  • ZjQrErrorCorrection.low, medium, quartile, high
  • ZjCharset.portuguese, multilingual, westernEurope, chinese, pc437

Example #

await ZjPosPrinter.connect();

await ZjPosPrinter.printText(
  'ZJ-6000 TEST SHOP\n',
  bold: true,
  size: ZjTextSize.large,
  align: ZjAlignment.center,
);

await ZjPosPrinter.printText('------------------------------\n');
await ZjPosPrinter.printText('1x Burger .......... \$ 15.00\n');
await ZjPosPrinter.printText('TOTAL: \$ 20.00\n', align: ZjAlignment.right);

await ZjPosPrinter.printQrCode(
  'https://www.setsistema.com.br',
  moduleSize: 6,
);

await ZjPosPrinter.printText(
  '\nObrigado pela atenção!\n\n',
  align: ZjAlignment.center,
);

Notes #

  • The plugin currently supports Android only.
  • Some printers require a short delay after the USB permission dialog before the first print.
  • QR Code support depends on ESC/POS compatibility in the connected printer firmware.
1
likes
160
points
119
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A Flutter plugin for ZJ-POS thermal printers via USB with support for formatting and CP860 accents.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on zj_pos_printer

Packages that implement zj_pos_printer