Closed smaharjan974 closed 2 years ago
Hey @smaharjan974 !
Thanks for reaching out about this. The library does not include an API for listing the USB devices and it instead prints to a single connected printer via USB.
If you have having trouble printing to a printer connected over USB make sure to check the following:
In my experience if you connect the USB cable while the printer is on, the device will not find the printer.
Hope this helps but please don't hesitate to reach out anytime if you are still having any trouble,
Hello @CodeMinion I have tired as you said. And My device support the OTG and i have successfully connect with another dependencies. Can you show the demo code to print through USB? I am using QL_800 brother printer.
Future<List
await printer.setPrinterInfo(printInfo);
return printer.getNetPrinters([
Model.QL_1110NWB.getName(),
Model.PJ_773.getName(),
Model.QL_800.getName(),
Model.QL_810W.getName(),
Model.QL_820NWB.getName()
]);
}
From this above code i always got No printer found.
Hey @smaharjan974 !
After you set the port to USB you should just be able to call one of the print functions. You are not getting any printers because the getNetPrinters() function is for getting a list of printers to connect over WiFi.
Here is a short sample for printing over USB using a QL-1110NWB and a W103 roll.
var printer = new Printer();
var printInfo = PrinterInfo();
printInfo.printerModel = Model.QL_1110NWB;
printInfo.printMode = PrintMode.FIT_TO_PAGE;
printInfo.isAutoCut = true;
printInfo.port = Port.USB;
printInfo.labelNameIndex = QL1100.ordinalFromID(QL1100.W103.getId());
await printer.setPrinterInfo(printInfo);
PrinterStatus status = await printer.printImage(picture);
How to show the list of devices throught the USB?