Closed TwenLeMammouth closed 1 year ago
Hello? Unfortunately I don’t have access to printer device now so I can’t test and fix it.
Have you tried to print another language ? Let’s say Chinese?
As a workaround you can use .data printing method and encode text manually with Japanese codepage. You can encode using https://www.npmjs.com/package/esc-pos-encoder#codepage this lib.
I.e.
let result = encoder .codepage('windows1251') .text('Iñtërnâtiônàlizætiøn') .codepage('cp936') .text('简体中文') .encode()
printing
// your printing commands .data(result) // your printing commands
.sendData()
Hope this helps
@TwenLeMammouth have you resolved the issue?
Yes, this is resolved, but not with the encoder.. There is some hardcoded english 'EPOS2_LANG_ANK', but I can't remember where, which sets the language to English. So changing the printer language doesn't work when you use 'EscPosPrinter.init()'.
But I now have another problem, I had to plug a second printer, and with '.discover()' it can find both, but one by one, I never get an array with both printers in it.. I tried to connect them both in ethernet, and both bluetooth, and also one Ethernet and one bluetooth.
@TwenLeMammouth you are talking about iOS and discovery?
I'm talking about this:
const printers = await EscPosPrinter.discover()
And yes, running on iOS.
we have a bug for iOS
Could you please try to discover with this code?
import {
NativeModules,
NativeEventEmitter,
} from 'react-native';
const { EscPosPrinter, EscPosPrinterDiscovery } = NativeModules;
const discoveryEventEmmiter = new NativeEventEmitter(EscPosPrinterDiscovery);
discoveryEventEmmiter.addListener(
'onDiscoveryDone',
(printers) => {
console.log(printers)
}
);
EscPosPrinterDiscovery.discover(params)
I can see every printers with this, thank you ! But I have a stupid question.. What needs to be pass as params in the last line...?
@TwenLeMammouth you can skip it. It's optional. But if you're interested you can read here https://github.com/tr3v3r/react-native-esc-pos-printer/blob/main/docs/API.md#discoverparams
we have a bug for iOS
Could you please try to discover with this code?
import { NativeModules, NativeEventEmitter, } from 'react-native'; const { EscPosPrinter, EscPosPrinterDiscovery } = NativeModules; const discoveryEventEmmiter = new NativeEventEmitter(EscPosPrinterDiscovery); discoveryEventEmmiter.addListener( 'onDiscoveryDone', (printers) => { console.log(printers) } ); EscPosPrinterDiscovery.discover(params)
@tr3v3r I am using Expo Development Client for React Native. I tried to access these { EscPosPrinter, EscPosPrinterDiscovery } from
const { EscPosPrinter, EscPosPrinterDiscovery } = NativeModules;
but I could not. How can i do this as I am not using Xcode for ios.
@TwenLeMammouth May i please ask how did you resolve the language issue? As i am facing the same situation. Could only print english properly, failed with EPOS2_LANG_JA, EPOS2_LANG_ZH_CN, EPOS2_LANG_ZH_TW
As I said in a message before, there was some hardcoded english settings, in some shady files(for me) in the library, writen in a language I don't know. Maybe you can try to search all the files for this parameter "EPOS2_LANG_ANK". I'm sorry I don't think I can help more, it was 2 years ago, I don't have access to a printer anymore.
In the end, this issue shouldn't be closed if it was fixed only on my side and not on the library..
Hi, we are trying to print receipt in Japanese, but we only get some katakana and some shapes that shouldn't be here.
await EscPosPrinter.init({ target: printer.target, seriesName: getPrinterSeriesByName(printer.name), language: 'EPOS2_LANG_JA', })
Usinglanguage: 'EPOS2_LANG_MULTI',
didn't work either. ( I thought I needed that to print japanese and english characters..) Printing Japanese character works very well with the Epson app.