januslo / react-native-sunmi-inner-printer

http://docs.sunmi.com/htmls/index.html?lang=zh##V1文档资源 根据商米V1文档开发的热敏打印
MIT License
74 stars 121 forks source link

Font styles #41

Open jairrc opened 5 years ago

jairrc commented 5 years ago

How to print text in Bold, Italic, Expanded, Compressed... how to set and stop this styles?

Regards,

d-lindau commented 5 years ago

I would love to see this as well.

Being able to use React-native is awsome. And being able to adjust fonts would be great.

mitchelson commented 3 years ago

First install yarn add base64-js After ` import base64 from 'base64-js';

    var boldActive = [0x1b, 0x45, 0x1];
    var boldCancel = [0x1b, 0x45, 0x0];
    var boldActiveStr = base64.fromByteArray(boldActive);
    var boldCancelStr = base64.fromByteArray(boldCancel);

    await SunmiInnerPrinter.setFontSize(30);
    await SunmiInnerPrinter.sendRAWData(boldActiveStr);
    await SunmiInnerPrinter.printOriginalText(' Text ');
    await SunmiInnerPrinter.sendRAWData(boldCancelStr);

`

d-lindau commented 3 years ago

Thank you! This is great. You made my day! You don't happen to know a way to change fonts as well @mitchelson ?