Skip to content

Telpo M1 doesn't print images #147

@gogori2

Description

@gogori2

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,
    );
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions