dart_pdf icon indicating copy to clipboard operation
dart_pdf copied to clipboard

MissingPluginException in Android with package printing: ^5.9.2

Open finnkassaoy opened this issue 1 year ago • 4 comments

Describe the bug

I/flutter (24015): PrintingInfo: I/flutter (24015): canPrint: true I/flutter (24015): directPrint: false I/flutter (24015): dynamicLayout: true I/flutter (24015): canConvertHtml: true I/flutter (24015): canListPrinters: false I/flutter (24015): canShare: true I/flutter (24015): canRaster: true E/flutter (24015): [ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: MissingPluginException(No implementation found for method pickPrinter on channel net.nfet.printing) E/flutter (24015): #0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:165:7) E/flutter (24015): E/flutter (24015): #1 MethodChannelPrinting.pickPrinter (package:printing/src/method_channel.dart:226:21) E/flutter (24015): E/flutter (24015): #2 Printing.pickPrinter (package:printing/src/printing.dart:116:12) E/flutter (24015): E/flutter (24015): #3 _MyHomePageState.testPrint (package:directprint/main.dart:51:21) E/flutter (24015): E/flutter (24015): #4 _MyHomePageState.build. (package:directprint/main.dart:89:15) E/flutter (24015): E/flutter (24015):

To Reproduce Code snippet to reproduce the behavior:

// your code

void testPrint() async{ final doc = pw.Document(); List<String> printers = []; doc.addPage(pw.Page( pageFormat: PdfPageFormat.roll57, build: (pw.Context context) { return pw.Center( child: pw.Text('Hello World, Testing the printer'), ); // Center })); await Printing.info().then((value) => print("Info ::: \n$value")); var myPrinter = await Printing.pickPrinter(context:context,); print('Selected printer: $myPrinter');

await Printing.listPrinters().then((value) async {
  print("**** Printing Printers");
  value.forEach((element) {
    print('Printer: ${element.name}');
    print('Model: ${element.model}');
    printers.add(element.name);
    printers.add(element.model!);
    description.text = '${element.name} : ${element.model} \n';
  });
  if(value.isNotEmpty){
    var result = await Printing.directPrintPdf(
        printer: value[0],
        onLayout: (PdfPageFormat format) async => doc.save()
    );
    print("result : $result");
  }
});

}

Desktop (please complete the following information):

  • [ ] Android

finnkassaoy avatar Aug 08 '22 09:08 finnkassaoy

canListPrinters: false in the Printing.info() result means you can't call listPrinters. Because it's not something the Android API provides.

DavBfr avatar Aug 08 '22 09:08 DavBfr

ok so directPrint also not possible from Android ?

finnkassaoy avatar Aug 08 '22 09:08 finnkassaoy

Exactly

DavBfr avatar Aug 08 '22 10:08 DavBfr

Thank you ...

finnkassaoy avatar Aug 08 '22 10:08 finnkassaoy

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days

github-actions[bot] avatar Aug 29 '22 00:08 github-actions[bot]

Closing this stale issue because it has no activity.

github-actions[bot] avatar Sep 04 '22 00:09 github-actions[bot]