Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows Printing printing is not completed with no error codes #54

Open
Adamsaeed-00 opened this issue Dec 4, 2024 · 2 comments
Open

Comments

@Adamsaeed-00
Copy link

hi , I am using the package but I want to network print on windows , the code :

`
Future printReceipt(
RestaurantDataProvider resProvider,
PrintersProvider printersProvider,
Order order,
UserProvider userPrvider,
paid,
returnvalue) async {
const PaperSize paper = PaperSize.mm80;
final profile = await CapabilityProfile.load();
final printer = NetworkPrinter(paper, profile);

await printersProvider.getPrinters();

final PosPrintResult res = await printer.connect(
    printersProvider.printers
        .where((v) => v['name'] == "main" || v['name'] == "cashier")
        .first['ip'],
    port: 9100,
    timeout: Duration(seconds: 20));

if (res == PosPrintResult.success) {
  // DEMO RECEIPT

  final image = await generateBill(
      resProvider, order, userPrvider.cashierUser!, paid, returnvalue);

  await testReceipt(printer, image);

  printer.drawer(pin: PosDrawer.pin2);

  printer.disconnect();
}

List qps = [];
for (var order in order.order) {
  final qp = printersProvider.printers.where((p) {
    return (p['cc'] as List).contains(order.category);
  });

  qps.addAll(qp);
}

for (var printerrr in qps) {
  if (printerrr['name'] != 'cashier') {
    final List<Item> items = [];
    for (var cat in printerrr['cc']) {
      List<Item> qi = order.order.where((p) {
        return (p.category)!.contains(cat);
      }).toList();
      items.addAll(qi);
    }
    if (items.isNotEmpty) {
      final PosPrintResult res =
          await printer.connect(printerrr['ip'], port: 9100);

      if (res == PosPrintResult.success) {
        // DEMO RECEIPT
        final image = await generateBillForKit(items);

        await testReceipt(printer, image);

        printer.disconnect();
      }
    }
  }
}

}
`

on android its a cake , but on the windows its not

flutter doctor : no issues found

@sabikrahat
Copy link

Hey @Adamsaeed-00,

I'm facing the same issue. Did you able to find any solution yet for windows?

@Adamsaeed-00
Copy link
Author

Hey @sabikrahat sorry for late reply , will you must reduce the print 64 bytes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants