januslo / react-native-bluetooth-escpos-printer

React-Native plugin for the bluetooth ESC/POS & TSC printers.
MIT License
351 stars 411 forks source link

SUNMI Bluetooth Printer #193

Open amcjml opened 2 years ago

amcjml commented 2 years ago

Hi, I used your package januslo/react-native-sunmi-inner-printer to Print in INNER SUNMI Printer. I used also your package januslo/react-native-bluetooth-escpos-printer to Connect to EXTERNAL SUNMI Printer via bluetooth. They are working fine. Thanks.

Can I use this package react-native-sunmi-inner-printer to connect to bluetooth printer?

Or using this one react-native-bluetooth-escpos-printer to connect but print with this one react-native-sunmi-inner-printer?

Thanks in advance.

waleediqbal224 commented 7 months ago

could you please help me with inner sunmi printer implementation? kinda stuck in implemeting this pkg

amcjml commented 7 months ago

@waleediqbal224 just follow the steps here https://github.com/suraneti/react-native-sunmi-v2-printer

matheusbento commented 2 months ago

hey guys, I'm using expo,

I run:

npx expo prebuild

and npx expo run:android

but its throwing errors

image

anyone know how to solve it?

amcjml commented 2 months ago

@matheusbento this package does not support Expo

matheusbento commented 2 months ago

@amcjml Should I create a react native from scratch?

amcjml commented 2 months ago

If you just started the then create it again with React Native from scratch. If not, you should eject the existing Expo project.

On Fri, May 3, 2024, 13:26 Matheus Bento @.***> wrote:

@amcjml https://github.com/amcjml Should I create a react native from scratch?

— Reply to this email directly, view it on GitHub https://github.com/januslo/react-native-bluetooth-escpos-printer/issues/193#issuecomment-2092915919, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXLIYEVX4ZLTXIKUYK425UDZAN66NAVCNFSM5Y33XO3KU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMBZGI4TCNJZGE4Q . You are receiving this because you were mentioned.Message ID: <januslo/react-native-bluetooth-escpos-printer/issues/193/2092915919@ github.com>

matheusbento commented 2 months ago

Guys, I was able to create from react native, but I still have an issue here.

If I do something like that:

await BluetoothEscposPrinter.printText(
        'TEST\n\r',
        {
          encoding: 'UTF-8',
        },
      );

the printer will works but it will not show, but if I do this:

await BluetoothEscposPrinter.printText(
        `test2 -\r\n`,
        {
          encoding: 'UTF-8',
         codepage: 1,
          widthtimes: 1,
          heigthtimes: 1,
          fonttype: 1,
        },
      );

it works but the font size is bigger, I would like some font lower, can you guys help me?

amcjml commented 2 months ago

@matheusbento here is the possiblities for font sizes:

Large font size

{
    encoding: 'UTF-8',
    widthtimes: 1,
    heigthtimes: 0,
    fonttype: 0,
}

Medium font size

{
    encoding: 'UTF-8',
    widthtimes: 1,
    heigthtimes: 0,
    fonttype: 1,
}

Small font size

{
    encoding: 'UTF-8',
    widthtimes: 0,
    heigthtimes: 0,
    fonttype: 0,
}
matheusbento commented 2 months ago

@amcjml

Thanks for you reply, but I tried this way:

await BluetoothEscposPrinter.printText("Hello, World!\r\n", {
        encoding: 'UTF-8',
        widthtimes: 0,
        heigthtimes: 0,
        fonttype: 0,
    });

the Hello, World doesn't print, I can't see anything.

but now if I change some params like:

await BluetoothEscposPrinter.printText(
        "Hello, World!\r\n",
        {
          encoding: 'UTF-8',
          codepage: 1,
          widthtimes: 1,
          heigthtimes: 1,
          fonttype: 1,
        },
      );

Maybe is an issue on my sunmi v2?

amcjml commented 2 months ago

write multiple await BluetoothEscposPrinter.printText() with different parameter each time to test what is working for you.

Example:

await BluetoothEscposPrinter.printText(
        "Hello, World!\r\n",
        {
          encoding: 'UTF-8',
          codepage: 0,
          widthtimes: 0,
          heigthtimes: 0,
          fonttype: 0,
        },
);
await BluetoothEscposPrinter.printText(
        "Hello, World!\r\n",
        {
          encoding: 'UTF-8',
          codepage: 0,
          widthtimes: 1,
          heigthtimes: 0,
          fonttype: 1,
        },
);

// and so on...
matheusbento commented 2 months ago

Yep. I tried, just this way I mentioned for you worked.

But this is a large font, I need a small size.

Do you had the same issue before?

amcjml commented 2 months ago

The possiblities for font sizes I showed you is working for me.

matheusbento commented 2 months ago

Which version of sunmi are you working with?

amcjml commented 2 months ago

We are working with a package created by us by making changes to the original package. https://www.npmjs.com/package/react-native-ec-thermal-printer Sorry I forgot about this. There is no documentation at this moment. But you can check the EcThermalPrinterInterface in EcThermalPrinter.ts file.

matheusbento commented 2 months ago

great, thanks @amcjml I will test it.

I tested this one: https://github.com/suraneti/react-native-sunmi-v2-printer and it works.

I will test yours, I would like to do something generic to all possible printers.

matheusbento commented 2 months ago

@amcjml just a question, can you share the github project?

Are you still using Bluetooth or do you find a way to native connect?

amcjml commented 2 months ago

@matheusbento yes I'm still using Bluetooth in addition of USB and Network.

Sorry, the project is confidential, I can't share it.

matheusbento commented 2 months ago

Bluetooth and 2g Wireless use the same radio frequency, if the POS machine doesn't have a great arch, it can become slow, do you already have this issue?

I also have a q2i pos machine, which enables only 2G and not 5G as SUNMI,

The internet connection with that is really slow when turning on Bluetooth for the printer.

@amcjml

amcjml commented 2 months ago

@matheusbento no I didn't have this problem before.

matheusbento commented 1 week ago

@amcjml Does your library supports sunmi v2?

I'm having issues with the current one, it printing really slow.

amcjml commented 1 week ago

Yes it support SUNMI V2. I don't have any idea.