CodeMinion / another_brother

Another Brother Flutter SDK
BSD 3-Clause "New" or "Revised" License
21 stars 21 forks source link

ERROR_FILE_NOT_FOUND #20

Closed twin250 closed 2 years ago

twin250 commented 2 years ago

Hello. Thank you for this plugin I have been having some fun with it today!

I have an issue with sending a file to my brother printer (model TD-4550DNWB). I have successfully been able to send a paragraph to it. When I try and send a .prn file I get the error ERROR_FILE_NOT_FOUND. I have loaded the asset into my yaml file and included it within the asset folder. I am testing this on my iPad.

Any assistance with this is greatly appreciated

CodeMinion commented 2 years ago

Hello @twin250 ,

Thanks for reaching out about this. Could you share the code you are using to send the file to the printer?

Thanks in advance!

twin250 commented 2 years ago

Hello. Getting the same error on my QL_820NWB. I have connected the devices on my network to test from my iPad. This is my code:

var printer = new Printer();
List<NetPrinter> netPrinters =
await printer1.getNetPrinters([Model.QL_820NWB.getName()]);
print("Net Printers Found: $netPrinters");
PrinterInfo printerInfo = PrinterInfo(
port: Port.NET,
printerModel: Model.QL_820NWB,
ipAddress: netPrinters[0].ipAddress,
macAddress: netPrinters[0].macAddress);
printerInfo.printMode = PrintMode.ORIGINAL;
printerInfo.isAutoCut = true;
printerInfo.numberOfCopies = 1;

await printer.setPrinterInfo(printerInfo);

PrinterStatus status = PrinterStatus();
bool success = await printer.startCommunication();
print("Connected to printer? $success");
print('calling print file');
status = await printer.printFile('assets/label.prn');
success = await printer.endCommunication();
print('closed print communication $success');

pubspec.yaml:

image

assets folder:

image

Thanks again!

CodeMinion commented 2 years ago

Thanks for the code @twin250 !

At a glance I believe the problem is that you are passing asset path. Print file requires the full path to the file being printed so you might need to first save the asset to a temp file and then path the path to that temp file to printFile.

twin250 commented 2 years ago

Thank you for your help. I have changed it to use FilePicker. The return status gives me ERROR_NONE but the printer does not print the file. I don't know if it's related to the set printer info. I will keep testing!

CodeMinion commented 2 years ago

Glad to hear it helped @twin250 .

It might not be the issue but in the past I have noticed that if you call endCommunication before the printing begins it never prints. Have you tried making the call without calling endCommunication?

twin250 commented 2 years ago

Hello @CodeMinion,

I have tried sending the file prints back to the TD-4550DNWB printer. It looks like it is doing something as the printer's LCD screen says "receiving" but nothing prints. I have tried taking out endCommunication. Hopefully, it's a setting I have overlooked.