Closed bosung90 closed 5 years ago
So...that is a raster printer. You need to convert your text into bitmap before you can print that out. P.S.: your print command on ios will throw an error, because you should not give the print command the portName if youre connected to it (on the other hand android requires it)
@cstudios-slovakia Thank you so much for your answer. I am planning to use it only on Android. I was wondering if this library is capable of converting text into bitmap without having to touch the native code. Thank you so much!!
@bosung90 i'm in the same situation. so did you end up using a command in this package to convert to bitmap?
@aysfzaicmu no I haven't had a chance to get it to work yet
@bosung90 @aysfzaicmu please give a try on appendBitmapText
command, this command worked for me.
@ararog appendBitmapText works only on iOS, implementation is missing on Android
we have a custom fork here https://github.com/cstudios-slovakia/react-native-star-prnt You can use the appendRasterText command. This works both on android and ios, tested with actual printers
anyone else getting "Fail to open Port", for the BT:TSP100. I've tried the print with portName and without parameter. Connect says it worked, check status says connected but print says Fail to open Port
let commands = [];
commands.push({
appendBitmapText:
"Star Clothing Boutique\n" +
"123 Star Road\n" +
"City, State 12345\n" +
"\n"
});
commands.push({ appendBitmap: image });
try {
//this.connect()
const result = await StarPRNT.print(this.emulation, commands, this.port);
alert('printed')
} catch(e) {
alert(JSON.stringify(e))
bugsnag.notify(e)
}
Make sure the printer does not have harware error. Empty paper, paper cutter misaligned. If its hardware error you should see a blinking red light, but you can listen to hardware events by attaching a listener, but for this you have to use StarPRNT.connect first, then you will be able to console log them out. But either way it should work.
@HunWalk thanks for the response. printer is working fine if I use the Star Print app they supply, it prints. From the docs I don't see how one would listen to the events?
@HunWalk I'm getting from status receiptPaperEmpty: true, its definitely full. and works when using their app
I've gotten barcode and QR code to print, but not appendBitmap. Any idea? I've tried sending in a uri, a base64 encoded image, but no success yet.
I commented something useful above:
we have a custom fork here https://github.com/cstudios-slovakia/react-native-star-prnt You can use the appendRasterText command. This works both on android and ios, tested with actual printers
There is no documentation, but here is a piece of code that works
makeBitmap = (base64) => {
if (Platform.OS === 'ios') {
return { appendBitmap: base64, diffusion: true, width: 320, bothScale: true, absolutePosition: (590-320)/2 }
}else{
return {
appendBase64Bitmap: base64.replace(/^data:image\/[a-z]+;base64,/, ""),
diffusion: true,
width: 400,
bothScale: true,
absolutePosition: (590 - 320) / 2
}
}
}
@HunWalk
I fixed it with:
commands.push({ appendBitmap: "file:" + image });
So now it works in my limited demo app... still no luck in the real app though.
@stefangeorg double check the emulation, but please try to solve it alone, use google or think before spamming comments under a github issue which was not opened for this case.
@infoxicator please close this issue, it's already going in a different direction. If you do not intend to maintain this repo please let me know.
Cheers
@HunWalk I can give you access to the repository and now if you want to help maintain it?
@infoxicator yepp, i could check the issues on this repo every week in order to patch some things up by sending a PR, but the first thing this repo really needs is some additional informations inside the docs, because people are too lazy to read the manuals of the devices. I'm gonna send a PR for this purpose. I don't really think I need access, unless you want to abandon this repo, or you really don't have time to maintain it.
I could do with some help specially publishing new versions to non I left the company I developed this plugin for and don’t have access to printers to test. I can add you as a contributor
Okay then, we have an mPop an L200 and a Paypoint for ipad device in here i can use for testing. You can reach me at gergely@cstudios.ninja for further communications
I was able to connect to the printer and send a print command.
However, every print only comes out with tiny little slip with partial cut.
this is my connect function
and print function