infoxicator / react-native-star-prnt

React-Native bridge to communicate with Star Micronics Bluetooth/LAN Printers
MIT License
67 stars 65 forks source link

TSP100III: append doesnt work, only appendBitmapText. #61

Closed stephengladney closed 3 years ago

stephengladney commented 4 years ago

When testing the example from the documentation...

commands.push({append:
        "Star Clothing Boutique\n" +
        "123 Star Road\n" +
        "City, State 12345\n" +
        "\n"});
commands.push({appendCutPaper:StarPRNT.CutPaperAction.PartialCutWithFeed});

The printer only cuts the paper. It does not print any text.

I was finally able to get it to print text with the appendBitmapText param. I am able to change fontSize on these commands. However, I cannot use methods like:

The result is a very constrained set of formatting and styling.

infoxicator commented 4 years ago

First thing to check is if you are using the correct emulation for your Printer, secondly check your printer command compatibility from the official StarSDK, not all printers allow all commands

ribamarsantos commented 4 years ago

Hello,

I had the same problem. My configs are Emulation: 'StarGraphic' My printer is: TSP100III TSP143IIIBI

I have used the native modules from the sample app and worked fine. Is there something I'm missing or is it some kind of limitation from the lib ?

Thanks in advance.

Lozrus commented 4 years ago

I have used the native modules from the sample app and worked fine. Is there something I'm missing or is it some kind of limitation from the lib ?

This is a limitation of the printer hardware, it is only able to support bitmap printing natively. As @infoxicator mentioned, please check the SDK documentation for compatibility details. When using "StarGraphic" emulation, the commands related to text printing are not available.

molchanovskiy commented 4 years ago

@stephengladney Did you find any solutions?

stephengladney commented 4 years ago

@molchanovskiy I'm stuck using appendBitmapText for the moment. The only other function from the entire library that I was able to get to work was the appendQrCode.

molchanovskiy commented 4 years ago

@stephengladney Same here :((

infoxicator commented 4 years ago

@molchanovskiy @stephengladney, unfortunately, this is a limitation of your printer model and the SDK, not the library itself 👍

Sam-Hoult commented 3 years ago

Thanks for this issue otherwise I would have thought this library was no use! This isn't aren't included in the types (having to cast any)

Lozrus commented 3 years ago

This seems to be a common difficulty, I.m a software engineer work for Star although (currently) I haven't used React Native so It's difficult to give any definite solution.

This library seems to be a very thin wrapper for the standard iOS or Android SDK's. On those platforms, StarGraphic only printing is generally handled by using the local canvas/drawing API, building the print job as an image, and then printing via the appendBitmap() method. Many developers prefer this method even, as it gives them much richer design options, font choices etc.

Is this approach viable with React Native?

stephengladney commented 3 years ago

@Lozrus appendBitmapText does work but the styling options are limited to: width, font, fontSize, bothScale, alignment

So you don't get things like bold, inverted, etc

Sam-Hoult commented 3 years ago

Is this approach viable with React Native?

@Lozrus we had done a custom build that we'd send HTML to, render the web view then send that image. We can't actually use the appendBitmapText as it doesn't allow use the flexibility to align. What we're doing now it rendering a view and capturing it then sending over that image using https://github.com/gre/react-native-view-shot however it can't do web views that well so we have to build out everything as components in a scroll view.

stephengladney commented 3 years ago

We ended up switching to the 650II model for our customers because it accepts text printing.

rockneverdies55 commented 3 years ago

@stephengladney you said:

appendBitmapText does work but the styling options are limited to: width, font, fontSize, bothScale, alignment

I can't set alignment with appendBitmapText command. Neither command's own alignment attribute nor appendAlignment command makes any difference. Every line gets printed left aligned. Were you able to change alignment since you said it's one of the styling options with the appendBitmatText command above?