Commit 7edeea6a authored by Andrey's avatar Andrey

Readme: Added Print image examples. Updated `esc_pos_utils` package version to `0.3.2`.

parent 07faaf9b
## [3.1.2]
* Updated `esc_pos_utils` package version to `0.3.2`.
## [3.1.1]
* Updated `esc_pos_utils` package version to `0.3.1` (Open Cash Drawer).
......
......@@ -88,16 +88,26 @@ ticket.row([
### Print an image:
This package implements 3 ESC/POS functions:
* `ESC *` - print in column format
* `GS v 0` - print in bit raster format (obsolete)
* `GS ( L` - print in bit raster format
Note that your printer may support only some of the above functions.
```dart
import 'dart:io';
import 'package:image/image.dart';
const String filename = './logo.png';
final Image image = decodeImage(File(filename).readAsBytesSync());
// Using (ESC *) command
final ByteData data = await rootBundle.load('assets/logo.png');
final Uint8List bytes = data.buffer.asUint8List();
final Image image = decodeImage(bytes);
// Using `ESC *`
ticket.image(image);
// Using an alternative obsolette (GS v 0) command
// Using `GS v 0` (obsolete)
ticket.imageRaster(image);
// Using `GS ( L`
ticket.imageRaster(image, imageFn: PosImageFn.graphics);
```
### Print a barcode:
......
......@@ -136,8 +136,9 @@ class _MyHomePageState extends State<MyHomePage> {
final Uint8List bytes = data.buffer.asUint8List();
final Image image = decodeImage(bytes);
ticket.image(image);
// Print image using an alternative (obsolette) command
// Print image using alternative commands
// ticket.imageRaster(image);
// ticket.imageRaster(image, imageFn: PosImageFn.graphics);
// Print barcode
final List<int> barData = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 4];
......
......@@ -15,7 +15,9 @@ dependencies:
image: ^2.1.4
esc_pos_printer:
path: ../../
esc_pos_utils: ^0.3.1
esc_pos_utils: ^0.3.2
# esc_pos_utils:
# path: ../../../esc_pos_utils
dev_dependencies:
flutter_test:
......
......@@ -65,8 +65,9 @@ Future<Ticket> testTicket() async {
// final Uint8List bytes = data.buffer.asUint8List();
// final Image image = decodeImage(bytes);
// ticket.image(image);
// Print image using an alternative (obsolette) command
// Print image using alternative commands
// ticket.imageRaster(image);
// ticket.imageRaster(image, imageFn: PosImageFn.graphics);
// Print barcode
final List<int> barData = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 4];
......
name: esc_pos_printer
description: The library allows to print receipts using an ESC/POS thermal WiFi printer.
version: 3.1.1
version: 3.1.2
homepage: https://github.com/andrey-ushakov/esc_pos_printer
environment:
......@@ -9,7 +9,7 @@ environment:
dependencies:
flutter:
sdk: flutter
esc_pos_utils: ^0.3.1
esc_pos_utils: ^0.3.2
# esc_pos_utils:
# path: ../esc_pos_utils
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment