Open TristanGodal opened 3 years ago
The problem is likely that you have not set the "Printer Settings" correctly to be appropriate for the printer model and paper that you are using.
If you look at the ObjC code for "printViaSDK" in BrotherPrinter.m, you'll see that it loads BRPtouchPrintInfo object settings from UserDefaults.
For example:
printInfo.strPaperName = [self stringValueFromDefaults:userDefaults forKey:kPaperLabelName withFallback:@"62mm"]; // Item 2
The plugin doesn't appear to provide any way to set these UserDefaults (that I can find at a quick glance). So, presumably you must set them yourself some other way. Refer to the BRUserDefaults.h file for a reference to the available keys/values.
So, if you have not set the default yourself, the strPaperName will "fallback" to "62mm".
And, with QL printers, if the strPaperName does not match the paper that is actually inserted to the printer, then you'll get an error when you try to print. So, I suspect that this is your problem.
It seems the plugin defaults generally for a QL model, so most of the other settings are likely OK. But, you may need to experiment with these settings to get your optimal results.
When you get to the TD2, this will have a completely different way of handling the paper.
I don't know how/if this plugin handles paper for TD and RJ series printer models. But, it doesn't seem to support it in the printViaSDK function. So, you will probably have to add the ObjC code yourself.
With TD/RJ models, you must call "setCustomPaperFile" on the BRPtouchPrinter object. And, you must pass it path to a paper BIN file.
Paper BIN files can be obtained by using the Windows Printer Driver (or the SDK that you can download from Brother website will contain some paper BINs, but these may not be what you need. Usually these are for "Continuous Roll" paper and not labels.)
NOTE: Each paper bin file must be "coded" for the specific model you use, so you can't use just any BIN file, it must for the right model.
NOTE: Other settings will likely have to change as well, since different settings in BRPtouchPrintInfo will be valid for each different model series.
Hope this helps!
Thank you, it works. Actually I just work with PDF to print. This plugin is expecting BMP file, is there a way to print the PDF ? Cause converting a PDF to BMP in javascript is quite tricky.
Thanks.
@TristanGodal Great! Glad that helped.
The iOS SDK actually has an API named "printPDFAtPath" (in v3 APIs, which is what this plugin is currently using). This API is used to print PDF files. I'm not certain if the Android SDK has similar capability if you need to support Android too; I believe the Android SDK requires printing each page of a PDF as an image, like this plugin allows. I support the iOS SDK, so I'm not 100% sure about Android.
As Brother does not "officially" support this plugin (I support it out of courtesy), I will not modify it myself to support PDF. But, you are welcome to try yourself. You can issue a Pull Request if you are successful to add both iOS and Android.
Of course, plugins will require both iOS and Android side....for Pull Request you can't do just one side. And, these modifications will require using the "native" programming languages for each platform, plus understanding the details about Cordova plugins (which I am not an expert with).
On iOS side, it would be pretty easy to do:
On Android side, refer to the SDK sample app (included with SDK download from our website) to see how it handles PDF files. Then, repeat what I mentioned above for iOS on the Android specific Java code inside this plugin. Then, modify the implementation in Java per how the SDK Sample app handles each PDF page.
Good luck!
Cheers, Rob
Hello, I'm starting using this cordova plugin. I got some problems when trying to detect devices. I'm working with Ionic 5+ and I'm just using this code :
Top of file :
In my ngOnInit():
My 2 label printers are on same network but the code above is returning an empty array.
Does anyone has an idea ?
Thanks.
EDIT :
I just achieved to detect my QL810W by modifying Info.plist on iOS.
Now when I try to print after setting the the printer, the console returns me :
Code :
Any idea ? Thanks.