Flutter Bluetooth printing to Zebra - flutter

I need to add printing functionality on a zebra zq520 bluetooth thermal printer.
I manage to do so using the flutter_blue plugin but I am not happy with the implementation.
I hate to break the string to smaller chunks in order to pass through bluetooth (and wait!!!!!).
I was wondering if there is a better approach, like the one we used in the (good?) old days of java for android using the android.bluetooth.BluetoothAdapter class
Thanks.

I ended up creating my own plugin.
source code
EDIT: 2021/11/29 integrate some comments from comments section
This code is not limited to zpl. In theory it can support every printer language that sends clear text to bluetooth serial
It is only for Android
For this source code to works as is:
You have to pair a bluetooth printer with name that starts with "zebra"
You have to send the zpl commands as string.
The easiest way to check that your zpl command is valid, is by using the ultra useful labelary viewer. The easiest way to test a label layout (font size, images, barcodes etc) is by using the above free service. in fact all you have to do, is to create the layout you need in labelary and the just copy the entire string from first ^XA to last ^XZ to FlutterCblue.printToBT. For example if you send this
printToBT("^XA
^FX Top section with logo, name and address.
^CF0,60
^FO50,50^GB100,100,100^FS
^FO75,75^FR^GB100,100,100^FS
^FO93,93^GB40,40,40^FS
^FO220,50^FDIntershipping, Inc.^FS
^CF0,30
^FO220,115^FD1000 Shipping Lane^FS
^FO220,155^FDShelbyville TN 38102^FS
^FO220,195^FDUnited States (USA)^FS
^FO50,250^GB700,3,3^FS
^FX Second section with recipient address and permit information.
^CFA,30
^FO50,300^FDJohn Doe^FS
^FO50,340^FD100 Main Street^FS
^FO50,380^FDSpringfield TN 39021^FS
^FO50,420^FDUnited States (USA)^FS
^CFA,15
^FO600,300^GB150,150,3^FS
^FO638,340^FDPermit^FS
^FO638,390^FD123456^FS
^FO50,500^GB700,3,3^FS
^FX Third section with bar code.
^BY5,2,270
^FO100,550^BC^FD12345678^FS
^FX Fourth section (the two boxes on the bottom).
^FO50,900^GB700,250,3^FS
^FO400,900^GB3,250,3^FS
^CF0,40
^FO100,960^FDCtr. X34B-1^FS
^FO100,1010^FDREF1 F00B47^FS
^FO100,1060^FDREF2 BL4H8^FS
^CF0,190
^FO470,955^FDCA^FS
^XZ")
You will get this:
One more thing: keep in mind that if you want to print special language characters (I need to print Greek) you have to find the correct font that is installed in your printer. For example: In order to print Greek characters I have to integrate this
^CWN,E:TT0003M_.FNT
just after the first ^XA. Then I use the N font in order to print Greek. It is very flexible if you understand the basics
Hope it helps

Related

How to set a fixed width for columns in mjml?

How to set a fixed width for columns in mjml?
I do not want to have classes or media queries for columns. I just want the columns to have a fixed width and I want that width to be a part of inlined styles for a column.
I need this, because, during forwarding Outlook removes all the classes and the classes which specify width for columns get stripped off as well. Also, I do not care about responsiveness.
If it is ambiguous whether you've used mj-column > width, I should suggest that as the first step. Perhaps you've used it.
Paradoxically, I'll suggest using mj-style inline="inline". In your MJML, target the HTML element you need using the technique suggested in https://documentation.mjml.io/#mj-html-attributes and Difficulty in understanding CSS-styling in MJML
If I understand your use case right, you need to get the necessary HTML attributes inside the HTML elements. MJML will put yours there because of the inline="inline" instruction above. That's the first HTML, the file MJML creates. With luck, the email client doing the forwarding won't change that. Maybe no client will change those; test carefully.
Your use case is challenging. Meeting the challenge of creating a generally forwardable email is huge; it's tough to know all possible modifications made at any one export or import at an email client, let alone the combined effect of combinations of clients. MJML typically makes email authors more efficient in getting email into all email clients the first time; MJML doesn't try to support forwarding. Each forward requires an export from the first email client and an import into the second. See https://www.litmus.com/blog/when-forwarded-emails-break/
BTW: In addition to StackOverflow, a great source of MJML support is https://mjml.slack.com/ You probably would have gotten a more prompt response there than this one. (Sorry!)

Reading Dogbone (Magnus 3) sensor tags with Zebra RFD8500

I'am trying to read the new sensor tags Dogbone, (with Magnus S3 IC) but I don't have luck.
I'am using Zebra RFD8500 and programming with the Zebra SDK for Android.
I want to read the RSSI or the temperature values, but it seems the problem is with the Select command.
In either case, it is a two step procedure : 1) select command to match a specific tag pattern in a specific pointer address at the MEMORY_USER_BANK. Then the IC detect that have to store
the solicited value in a specific address at the MEMORY_RESERVED_BANK and 2) read the value, from the specific address at the MEMORY_RESERVED_BANK.
For the Select command (C1G2) I tried with Access-filters and Pre-Filters, but although the tag is matched, the IC doesn't store a value in the RESERVED Bank.
Somebody knows if Zebra APIs support the reading of this newers tags ? Or suggest me any other test?
Thanks a lot for your help
Regards.
It's possible to read the RSSI value with EPC Gen2 tags, so if the tag you're referring to supports this standard it should work.
Try downloading the Zebra RFID sample app > Perform inventory > If the tag is found it should display the RSSI. The sample app code can be found here
As for the temperature values try reading the USER memory in the sample app as well to see if you can get it.
I suggest using the SLS smartSLED; it has built-in functionality for the Magnus (Axzon) chip family (both S2 and S3).

Why watson Personality Inisights shows different results using different API versions/demo

My apologies if the question is duplicated. We are facing an issue with the analysis of a profile using Watson Personality Insights API in Spanish. We have a demo we implemented using PI API version 2 and then we tested the results (exact same text) with the demo published on developer cloud(in spanish) and we found important differences on how the big five were calculated when the facet values were not that different. Is it possible that these differences are caused because of the API version? The issue that with our demo the big five values produced a kind of negative summary profile when the developercloud summary is kinder.
We could send both result jsons. For example here is how the big five rated:
BigFive DeveloperCloud Demo V2
Openness 0.773834349 0.847273232
Conscientiousness 0.916616088 0.914907481
Extraversion 0.796331544 0.612606551
Agreeableness 0.17445636 0.096118648
Emotional range 0.036287447 0.01623536
thanks in advance!!
So the API version would not make a difference, as that just governs the format of the API; the back-end models are the same for both v2 and v3 of the API.
So the jist of your question is that when you run the same text in your app, and in the demo you get different big5 results, while the facet values are about the same.
This might be easiest solved by you opening a support ticket so we can debug the issue together; if you'd rather not do that then can you provide a sample text? Typically it boils down to a difference in the way the text is parsed.
Another question; did you try making the request using curl? That would cut out any custom logic in your app and narrow down the problem.
thanks Neil for you answer!
We tested the text using CURL and we noticed that the results didn't change by the service version used but instead by how the text was sent. If we called the service using curl passing a plain text input(formatted in UTF-8 with line breaks) it returned the same results for version2 and version 3 and also matched the ones from our demo. If we called the service using curl passing json input WITHOUT line breaks it returned the same values as well. But if we called the service passing the json input WITH line breaks then the results changed and almost matched those shown by ibm demo. My question here is which are the correct results? The ones shown when the text is sent as a plain text input(with line breaks) or when the text is sent as json input(with line breaks)? Is there any technical guideline besides the one shown in developercloud on how the text should be parsed to use this service?
Thanks again!

AutoHotKey ControlGet

I have a script that is throwing and error when I issue a ControlGet.
OtPtVar := AfxWnd422
strMPP := Material Planning Profile
ControlFocus,%OtPtVar%,,%strMPP%
Control,Show,,%OtPtVar%,,%strMPP%
These all work but when it gets to the next line it throws an error:
ControlGet,sysList,List,,%OtptVar%,,%strMPP%
The control is a grid with five fields row number,Part,Description,Time,Lateness.
`ControlFocus,%OtPtVar%,,%strMPP%`
`Control,Show,,%OtPtVar%,,%strMPP%`
`ControlGet,sysList,List,,%OtPtVar%,,%strMPP%`
The error occurs on the last line.
Thank you.
After searching the AutoHotKey site I found to the following:
Those Afx window classes were custom classes distributed with early versions of MFC, before the "Common Controls" concept was introduced.
Many people have tried to "read" text from them but you CAN'T, not with messages anyway!
They're almost certainly owner-drawn - the text is not delivered by messages, it's "hand-drawn" into the window's DC
...
Messages are a dead-end I think - those who have pursued this problem must have already clocked up several hundreds of hours of monitoring message traffic between them!
So its not possible to get a hold of the control.
ControlGet's List subcommand can only handle standard listview controls, which usually have the class 'SysListView32'.
Did you try AccViewer just in case.
This link mentions textcapturex by Deskperience Software in case that helps.
"AfxWnd42s" Please Help - AutoIt General Help and Support - AutoIt Forums
https://www.autoitscript.com/forum/topic/49057-afxwnd42s-please-help/
There are theoretically process hacker methods,
but I'm not an expert on those, and wouldn't recommend such methods.
And yes, unfortunately when I really needed to, I used OCR once.
Potentially you can do OCR, recreate the text in the same font,
and check for an exact image match as a double-check.
Also, if possible, set the font to one where characters such as capital i and small L are unambiguous.

How to use PDFTextExtractor on iTextSharp

I want to retrieve the text from a pdf file using iTextSharp. However, I wasn't able to use PDFTextExtractor as in JAVA library of itextsharp(itext). I need readPDFOffline class to return content of file. I will give the pseudo below for you to understand well what I want.
private string readPDFOffline(string fileUri);
read PDF;
retrieve Text Content of This Pdf;*
save content into string contentOfflineFile;
return contentOfflineFile;
I would like to do the * part of Code
PdfTextExtractor is present in the most recent releases of iTextSharp, available here.
Retrieving text in PDF is not easy. Not impossible, but there are times when the only thing that will work is OCR. For all other cases, PdfTextExtractor should work. Cases of it not working are considered bugs and should be reported as such.
Be aware that there are several cases where what looks like valid text is not extractable:
Text with no encoding... just glyph indexes. OCR time.
"Text" that is just raw paths. Horribly inefficient, and time for more OCR.
"Text" that is pixels in a bitmap. OCR once more.
OCR: Optical Character Recognition. There's even a reasonably good one for free available on Google Code, though I don't recall the name off the top of my head.