How to convert bitmap to 1 bit byte array?
I generated a barcode with ZXing.Mobile.Net and intend to print it to a thermal via bluetooth...
Sending a normal byte doesn't work (refer to image 1)
I did some searching and found that I had to send something called a 1-bit image byte array (one bit per printer "pixel") (refer to image 2)
found @: https://stackoverflow.com/questions/50698559/xamarin-print-image-in-bluetooth-printer
Image 3: my code so far
Image 4 & 5: Printer Commands Documentation
Printer Model : CMX 8006
Stack Overflow
Xamarin Print Image in bluetooth printer
I am trying print from Bluetooth printer (INTERMEC PB51), using Xamarin native android.
I have written the code based on the below link.
How can I print an image on a Bluetooth printer in Android...
15 Replies
@ZacharyPatten pinged as requested
thanks. have to go offline now though. will give it a look if/when have time. you provided more info, need to closely read all to grasp the issue
alright, thanks!
also can you list the model # of the printer
nvm
INTERMEC PB51
right?
ah, not really
o crap i see it now
CMX 8006
honestly couldnt find it on the net, so i figured the printer itself is pirated to some degree so i just used the docs that came with the printer
you had to buy an off-brand obscure product from china didn't you...
ðŸ˜
I like how you tags this as "beginner"
this is not beginner 😄
anyways... gtg... will ping you if I find out anything
im self taught so i have no idea whats beginner and whats not lmao
alright, lots of thanks!
this is advanced
not following this closely but one thing I spotted is you're sending 0 for the image Height parameter
and I can't speak to whether you're encoding your pixel data correctly
ah no, nH isn't "Height" 🤔
oh I get it
nL+nH+256
is a funny way of saying the data length is a 16-bit number
so with your parameters you're saying you're providing an image with 255 dots
I'm curious about how you set the image width and height then, unless the printer expects a fixed width and expects you to pad the image accordingly
L = (nH << 8) + nL
where nH
is no more than 3, so max dots is 0x3ff or 1023
and if it's per-line, then you need to emit the same escape sequence for every linethere's something smudgy here, what is that?
alright, turns out there's a way to print barcodes specifically, so im just going to do that instead of trying to print an image of a barcode