dart_pdf
dart_pdf copied to clipboard
MissingPluginException in Android with package printing: ^5.9.2
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):
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
canListPrinters: false in the Printing.info() result means you can't call listPrinters. Because it's not something the Android API provides.
ok so directPrint also not possible from Android ?
Exactly
Thank you ...
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
Closing this stale issue because it has no activity.