{"id":19175695,"url":"https://github.com/24jieqi/react-native-printer-sunmi","last_synced_at":"2025-07-20T10:34:33.131Z","repository":{"id":57339208,"uuid":"392894769","full_name":"24jieqi/react-native-printer-sunmi","owner":"24jieqi","description":"🖨 基于商米内置打印机 SDK 封装的 React Native 模块","archived":false,"fork":false,"pushed_at":"2024-01-23T02:12:56.000Z","size":1368,"stargazers_count":14,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-05-07T19:11:26.605Z","etag":null,"topics":["native-module","printer","react-native","sunmi"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/24jieqi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2021-08-05T03:50:10.000Z","updated_at":"2025-02-13T06:15:47.000Z","dependencies_parsed_at":"2024-01-23T03:28:09.851Z","dependency_job_id":"aa467b9b-211c-47c2-9c72-3feadaa2ba42","html_url":"https://github.com/24jieqi/react-native-printer-sunmi","commit_stats":{"total_commits":23,"total_committers":1,"mean_commits":23.0,"dds":0.0,"last_synced_commit":"3f8988160a0ed247fb9f74906a6b34d2437778f0"},"previous_names":["24jieqi/react-native-printer-sunmi","hjfruit/react-native-printer-sunmi"],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/24jieqi/react-native-printer-sunmi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/24jieqi%2Freact-native-printer-sunmi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/24jieqi%2Freact-native-printer-sunmi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/24jieqi%2Freact-native-printer-sunmi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/24jieqi%2Freact-native-printer-sunmi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/24jieqi","download_url":"https://codeload.github.com/24jieqi/react-native-printer-sunmi/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/24jieqi%2Freact-native-printer-sunmi/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266111439,"owners_count":23877980,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["native-module","printer","react-native","sunmi"],"created_at":"2024-11-09T10:24:35.402Z","updated_at":"2025-07-20T10:34:33.076Z","avatar_url":"https://github.com/24jieqi.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-native-printer-sunmi `v2`\n\n\u003e 基于商米新版 `Printx` SDK 实现的打印原生模块\n\n### v1.x 基于旧版 SDK 的实现仍然可用，使用方式见[文档](./README.old.md)\n\n## 安装\n\n```sh\nnpm install react-native-printer-sunmi\n```\n\n## Usage\n\n```js\nimport PinterSunmi from 'react-native-printer-sunmi';\n\n// ...\nasync function print() {\n  await PrinterSunmi.connect();\n  PrinterSunmi.enableTransMode(true);\n  PrinterSunmi.initLine({ align: 'CENTER' });\n  PrinterSunmi.printText('测试小票打印', { textSize: 32, bold: true });\n  PrinterSunmi.addText('购物列表\\n', { bold: true });\n  PrinterSunmi.initLine();\n  PrinterSunmi.addText('小计：3件\\n');\n  PrinterSunmi.printTexts([\n    { text: '商品', span: 2 },\n    { text: '价格', span: 1, align: 'RIGHT' },\n    { text: '数量', span: 1, align: 'RIGHT' },\n  ]);\n  PrinterSunmi.printTexts([\n    { text: '鲜榴莲', span: 2 },\n    { text: '22', span: 1, align: 'RIGHT' },\n    { text: 'X3', span: 1, align: 'RIGHT' },\n  ]);\n  PrinterSunmi.printDividingLine('EMPTY', 24);\n  PrinterSunmi.printDividingLine('SOLID', 2);\n  PrinterSunmi.printDividingLine('EMPTY', 24);\n  PrinterSunmi.printTrans();\n}\n```\n\n## API\n\n\u003e ⚠️ 钱箱控制接口\u0026LCD 客显控制接口暂未测试\n\n### connect: () =\u003e Promise`\u003cboolean\u003e` 连接/获取打印机\n\n### disconnect: () =\u003e void 断开连接/释放 SDK\n\n### watchError(errorHandler: (payload: PrintErrorMessage) =\u003e void) =\u003e () =\u003e void 异常监听\n\n### getInfo: () =\u003e PrinterInfo 获取打印机信息\n\n### 钱箱控制接口\n\n#### openCashDrawer: () =\u003e void 开启钱箱\n\n#### isCashDrawerOpen: () =\u003e boolean 获取钱箱状态\n\n### LCD 客显控制接口\n\n#### lcdConfig: (command: LCDCommod) =\u003e void 控制客显屏的状态\n\n#### lcdShowText: (content: string, config: LCDShowTextConfig) =\u003e void 显示指定大小的文本内容\n\n#### lcdShowTexts: (texts: LCDShowTextsItem[]) =\u003e void 显示多行文本内容\n\n#### lcdShowBitmap: (uri: string) =\u003e void 显示位图图像\n\n#### lcdShowDigital: (digital: string) =\u003e void 显示价格内容\n\n\u003e 其余用作打印的 `API`同[商米内置打印机服务文档](https://developer.sunmi.com/docs/zh-CN/xeghjk491/maceghjk502)，更多示例见[example](./example/src/App.tsx)\n\n### 接下来\n\n- [x] 打印文件接口\n- [x] 指令集打印\n- [x] 钱箱控制\n- [x] LCD 客显控制接口\n- [ ] 配置式 API\n\n## License\n\nMIT\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F24jieqi%2Freact-native-printer-sunmi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F24jieqi%2Freact-native-printer-sunmi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F24jieqi%2Freact-native-printer-sunmi/lists"}