{"id":34924513,"url":"https://github.com/oolio-group/xml-escpos-helper","last_synced_at":"2025-12-26T14:18:11.259Z","repository":{"id":38461303,"uuid":"329238106","full_name":"oolio-group/xml-escpos-helper","owner":"oolio-group","description":null,"archived":false,"fork":false,"pushed_at":"2024-01-29T03:47:01.000Z","size":2736,"stargazers_count":36,"open_issues_count":13,"forks_count":14,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-11-23T16:02:30.778Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oolio-group.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-13T08:14:05.000Z","updated_at":"2025-09-30T13:24:10.000Z","dependencies_parsed_at":"2024-06-18T21:37:03.013Z","dependency_job_id":"b7928e58-c870-49f2-bf7b-4d507f139bcc","html_url":"https://github.com/oolio-group/xml-escpos-helper","commit_stats":null,"previous_names":["oolio-group/xml-escpos-helper","hitz-group/xml-escpos-helper"],"tags_count":26,"template":false,"template_full_name":null,"purl":"pkg:github/oolio-group/xml-escpos-helper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oolio-group%2Fxml-escpos-helper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oolio-group%2Fxml-escpos-helper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oolio-group%2Fxml-escpos-helper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oolio-group%2Fxml-escpos-helper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oolio-group","download_url":"https://codeload.github.com/oolio-group/xml-escpos-helper/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oolio-group%2Fxml-escpos-helper/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28055968,"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","status":"online","status_checked_at":"2025-12-26T02:00:06.189Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2025-12-26T14:18:09.604Z","updated_at":"2025-12-26T14:18:11.253Z","avatar_url":"https://github.com/oolio-group.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Originally forked from [here](https://github.com/ingoncalves/escpos-xml)\n\n# ESC/POS XML\n\nCross platform JavaScript library that implements the thermal printer ESC / POS protocol and provides an XML interface for preparing templates for printing.\n\n## Features\n\n- [x] Text\n- [x] Text line\n- [x] Feed line\n- [x] Bold text\n- [x] Underline text\n- [x] Font size\n- [x] Small mode\n- [x] White mode\n- [x] Align\n- [x] Barcode\n- [x] QRcode\n- [x] Paper cut node\n- [x] Image (base64) (png only)\n- [x] XML with mustache\n\n\n## Tested manually on following environments or platforms\n\n- [x] React Native (Android)\n- [x] React Native (iOS)\n- [x] React Native Web\n- [x] Server side (NodeJs)\n- [x] Desktop applications (nwjs \u0026amp; electron)\n- [x] Other node environment (terminal)\n\n\n## Installation\n\n```bash\n  yarn add @oolio-group/xml-escpos-helper\n```\n\n## Examples\n\n### With an XML template +  plain object input (regular text).\n\n```ts\n\nimport { EscPos } from '@oolio-group/xml-escpos-helper';\n\n// store this template somewhere `s3` or as `static asset` based on your preference \nconst template = `\n  \u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n  \u003cdocument\u003e\n    \u003calign mode=\"center\"\u003e\n      \u003cbold\u003e\n        \u003ctext-line size=\"1:0\"\u003e{{title}}\u003c/text-line\u003e\n      \u003c/bold\u003e\n    \u003c/align\u003e\n\n    {{#thankyouNote}}\n    \u003calign mode=\"center\"\u003e\n      \u003ctext-line size=\"0:0\"\u003e  {{{thankyouNote}}}\u003c/text-line\u003e\n    \u003c/align\u003e\n\n    \u003cline-feed /\u003e\n\n    \u003cpaper-cut /\u003e\n  \u003c/document\u003e\n`;\n\nconst input = {\n  title: 'Sample',\n  thankyouNote: 'Welcome...!'\n};\n\nconst buffer = EscPos.getBufferFromTemplate(template, input);\n// send this buffer to a stream (eg.: bluetooth or wifi)\n\n```\n\n### With an XML template +  png image (base64)\n\n```ts\n  const template =  `\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n  \u003cdocument\u003e\n    \u003calign mode=\"center\"\u003e\n      \u003cbold\u003e\n        \u003ctext-line size=\"1:0\"\u003e{{title}}\u003c/text-line\u003e\n      \u003c/bold\u003e\n        \n      \u003cimage density=\"d24\"\u003e\n        {{base64PngImage}}\n      \u003c/image\u003e\n    \u003c/align\u003e    \n  \u003c/document\u003e`;\n\n  const input = {\n    title: 'PNG - base64',\n    base64PngImage: `data:image/png;base64,iVBORw0KGgoAAA+P/AaNn2GPEMgEFAAAAAElFTkSuQmCC`\n  };\n\n  const buffer = EscPos.getBufferFromTemplate(template, input);\n```\n\n---\n\n## TODO\n\n- [ ] Font styles (font family)\n- [ ] Image bitmap conversion improvements\n- [ ] jpeg support\n- [ ] Add example apps to repo\n- [ ] Removed uglify for some reason, need to bring it back\n- [ ] Improve image rendering\n\n## Common issues\n\n- If there is any delay you observe while printing with this library it is mostly due to image manipulations (try without image :mask: )\n\n\n## Useful links / resources\n\n- [ESC / POS Commands manual](./resources/ESCPOS_Command_Manual.pdf) \n- A [blog post](https://www.visuality.pl/posts/thermal-printer-protocols-for-image-and-text#:~:text=How%20can%20we%20print%20an,command%20language%20of%20thermal%20printers) explaiing about printing images with ESCPOS \n- Similar library for serverside - [node-escpos](https://github.com/song940/node-escpos).\n\n\u003e Limitations on the react-native framework\n\n- [FileReader.readAsArrayBuffer](https://github.com/facebook/react-native/issues/21209) was not implemented.\n- Most of popular image manupulation libraries does not have support for react-native. eg : [jimp](https://www.npmjs.com/package/jimp), [jpeg-js](https://www.npmjs.com/package/jpeg-js) and [sharp](https://www.npmjs.com/package/sharp). We can use these libraries with some native node lib implemented in react native (some sort of polyfill).  \n- For png this [library](https://github.com/photopea/UPNG.js) seems to be faster, but when tested this library with it, it is not retaining pixels at some places) \n- Use this [node-libs-react-native](https://www.npmjs.com/package/node-libs-react-native) if we need to use this library in react native (adds some mock or js implementation for fs, stream etc)\n\n---\n\nContributions of any kind welcome! :heart:\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foolio-group%2Fxml-escpos-helper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foolio-group%2Fxml-escpos-helper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foolio-group%2Fxml-escpos-helper/lists"}