Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Printing in arabic is not working. #50

Open
tawfek opened this issue Sep 1, 2023 · 0 comments
Open

Printing in arabic is not working. #50

tawfek opened this issue Sep 1, 2023 · 0 comments

Comments

@tawfek
Copy link

tawfek commented Sep 1, 2023

I'm trying to print Arabic text on a POS printer.
i have tried both "star" and "Epson" types
and i have tested on both wpc1256_arabic and pc864_arabic .

Printing in English is working fine. printing images using <Image src.. /> also works fine.
but when I try to print an Arabic text, it shows an unknown character. (not ???)

Printer function:

  const printer = async () => {
 
    if (!printerState) {
     // connecting to printer
       ....
           setPrinterState(() => characteristic);
       ....
    }

    printing();
  };

Printing function

  const printing = async () => {
    const data = await render(
      <Printer type="star" width={88} characterSet="wpc1256_arabic">
        <Text>مرحبا بك في رياكت</Text>
      </Printer>
    );
    // Print the data in chunks
    await printChunks(printerState, data);
  };
printChunks function:
  const sendChunk = async (printerState, chunk) => {
    try {
      await printerState.writeValueWithResponse(chunk);
    } catch (error) {
      console.error(`Error sending data chunk: ${error}`);
      throw error;
    }
  };
Printer trigger:
  <Button type="primary" onClick={printer}>
        PRINT
  </Button>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant