-
Notifications
You must be signed in to change notification settings - Fork 381
Open
Description
Printer only feeds two lines, instead of image, but when I print text, it works just fine. How can I know where is the issue?
flutter_bluetooth_printer: 2.17.1
esc_pos_utils_plus: 2.0.4
on flutter 3.24.1
import 'package:esc_pos_utils_plus/esc_pos_utils_plus.dart' as escpos;
import 'package:flutter_bluetooth_printer/flutter_bluetooth_printer_library.dart';
import 'dart:convert';
void print() async {
const assetPath = 'assets/images/bitmap2.png';
final ByteData data = await rootBundle.load(assetPath);
var imBytes = data.buffer.asUint8List();
final profile = await escpos.CapabilityProfile.load();
final generator = escpos.Generator(escpos.PaperSize.mm58, profile);
final reset = generator.reset();
List<int> bytes = [];
final img.Image imgImage = img.decodeImage(imBytes)!;
bytes += generator.image(imgImage, align: escpos.PosAlign.left);
var data = Uint8List.fromList([
...bytes,
...reset,
]);
await FlutterBluetoothPrinter.printBytes(
address: printerAddress,
data: data,
keepConnected: false,
);
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels