Skip to content

Can you confirm if there is a problem with accentuation? #136

@ewertonrfd

Description

@ewertonrfd

Hi,
I am make this code:

Future<String> print(dynamic pedido) async {
    List<int> bytes = [];
    final profile = await _profile;
    final generator = Generator(PaperSize.mm80, profile);

    bytes += [27, 97, 1];
    bytes += generator.text('Pedido #${pedido['id']}', styles: const PosStyles(bold: true, height: PosTextSize.size2));

    bytes += [27, 97, 1];
    bytes += generator.text('Cliente : ${pedido['customer']['user']['name']}');
    bytes += generator.text('Email : ${pedido['customer']['user']['email']}');

    bytes += [27, 97, 1];
    bytes += generator.feed(1);

    bytes += generator.row([
      PosColumn(
        text: 'Quant',
        width: 2,
        styles: const PosStyles(align: PosAlign.left),
      ),
      PosColumn(
        text: 'Item',
        width: 8,
        styles: const PosStyles(align: PosAlign.center),
      ),
      PosColumn(
        text: 'Preco',
        width: 2,
        styles: const PosStyles(align: PosAlign.right),
      ),
    ]);

    for (var item in pedido['products']) {
      bytes += generator.row([
        PosColumn(
          text: item['pivot']['quantity'].toString(),
          width: 2,
          styles: const PosStyles(align: PosAlign.center),
        ),
        PosColumn(
          text: '${item['name']} (${item['description']})',
          width: 8,
          styles: const PosStyles(align: PosAlign.center),
        ),
        PosColumn(
          text: ' ${item['pivot']['subtotal'].toString()}',
          width: 2,
          styles: const PosStyles(align: PosAlign.center),
        ),
      ]);
    }

    bytes += generator.feed(1);
    bytes += [27, 97, 1];
    bytes += generator.text('Total  R\$ ${pedido['total_price']}');

    bytes += [27, 97, 1];
    bytes += generator.text('Data : ${pedido['created_at']}');
    bytes += generator.feed(1);
    bytes += generator.text('*** Obrigado por seu ço pédido ***', styles: const PosStyles(bold: true, height: PosTextSize.size2), containsChinese: true);

    bytes += generator.feed(1);
    bytes += generator.cut();

    final res =
    await usb_esc_printer_windows.sendPrintRequest(bytes, _printerName);
    String msg = "";

    if (res == "success") {
      msg = "Printed Successfully";
    } else {
      msg =
      "Failed to generate a print please make sure to use the correct printer name";
    }

    return msg;
  }

Along these lines, I even tried some settings, but it didn't help.

bytes += generator.text('*** Obrigado por seu ço pédido ***', styles: const PosStyles(bold: true, height: PosTextSize.size2), containsChinese: true);

Thanks

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