To create a receipt, define a JSX structure using the <Printer> component and its children (<Text>, <Row>, <Line>, <Br>, <Cut>, etc.). Once the receipt structure is defined, use the render function to convert the JSX into a Uint8Array containing the raw printer commands.
Common <Printer> props include:
type: The printer protocol (e.g., "epson").width: The character width of the printer.characterSet: The character set to use (e.g., "korea").
import { Br, Cut, Line, Printer, Text, Row, render } from 'react-thermal-printer';
const receipt = (
<Printer type="epson" width={42} characterSet="korea">
<Text size={{ width: 2, height: 2 }}>9,500원</Text>
<Text bold={true}>결제 완료</Text>
<Br />
<Line />
<Row left="결제방법" right="체크카드" />
<Row left="카드번호" right="123456**********" />
<Line />
<Text align="center">Wifi: some-wifi / PW: 123123</Text>
<Cut />
</Printer>
);
const data: Uint8Array = await render(receipt);