andrey-ushakov / esc_pos_printer

ESC/POS (thermal, receipt) printing for Flutter & Dart
BSD 3-Clause "New" or "Revised" License
346 stars 298 forks source link

Styles (QrCode, BarCode) dont print. #160

Closed visued closed 1 year ago

visued commented 1 year ago

On printer LK-P41 printer

On Printer LK-P21 printer2

hello, my styles are not being printed on this printer, I am using a SEWOO LK-P41, on the LK-P21 printer it is printing normally. The difference between the two printers is that the LK-P41 has a wider paper width than the LK-P21

Flutter version: Flutter 3.3.2 • channel stable • https://github.com/flutter/flutter.git Framework • revision e3c29ec00c (4 weeks ago) • 2022-09-14 08:46:55 -0500 Engine • revision a4ff2c53d8 Tools • Dart 2.18.1 • DevTools 2.15.0

Future<List<int>> getInvoiceTicket(InvoiceModel invoice) async {
    List<int> bytes = [];
    CapabilityProfile profile = await CapabilityProfile.load();
    final generator = Generator(PaperSize.mm80, profile);

    bytes += generator.text(invoice.invoice.a02,
        styles: const PosStyles(align: PosAlign.center));
    bytes += generator.text(invoice.invoice.a03,
        styles: const PosStyles(align: PosAlign.center));
    bytes += generator.hr(len: 68);
    bytes += generator.text('Qr Code para PIX',
        styles: const PosStyles(align: PosAlign.center));
    bytes += generator.text('(QUALQUER BANCO)',
        styles: const PosStyles(align: PosAlign.center));
    bytes += generator.qrcode(invoice.invoice.e02,
        size: QRSize.Size6, align: PosAlign.center);
    bytes += generator.cut();

    return bytes;
  }
visued commented 1 year ago

I solved it, my printer was configured for another language, I changed it to ESC/POS and now it prints normally.