react-native-bluetooth-escpos-printer icon indicating copy to clipboard operation
react-native-bluetooth-escpos-printer copied to clipboard

SUNMI Bluetooth Printer

Open amcjml opened this issue 2 years ago • 21 comments

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.

amcjml avatar Jun 15 '22 16:06 amcjml

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

waleediqbal224 avatar Dec 16 '23 09:12 waleediqbal224

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

amcjml avatar Dec 18 '23 09:12 amcjml

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?

matheusbento avatar May 02 '24 23:05 matheusbento

@matheusbento this package does not support Expo

amcjml avatar May 03 '24 08:05 amcjml

@amcjml Should I create a react native from scratch?

matheusbento avatar May 03 '24 12:05 matheusbento

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>

amcjml avatar May 03 '24 13:05 amcjml

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?

matheusbento avatar May 08 '24 23:05 matheusbento

@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,
}

amcjml avatar May 09 '24 08:05 amcjml

@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?

matheusbento avatar May 09 '24 11:05 matheusbento

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...

amcjml avatar May 09 '24 12:05 amcjml

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?

matheusbento avatar May 09 '24 12:05 matheusbento

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

amcjml avatar May 09 '24 14:05 amcjml

Which version of sunmi are you working with?

matheusbento avatar May 09 '24 15:05 matheusbento

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.

amcjml avatar May 09 '24 16:05 amcjml

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 avatar May 09 '24 17:05 matheusbento

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

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

matheusbento avatar May 14 '24 18:05 matheusbento

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

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

amcjml avatar May 15 '24 07:05 amcjml

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

matheusbento avatar May 16 '24 13:05 matheusbento

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

amcjml avatar May 16 '24 14:05 amcjml

@amcjml Does your library supports sunmi v2?

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

matheusbento avatar Jul 05 '24 17:07 matheusbento

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

amcjml avatar Jul 05 '24 17:07 amcjml