{"_rev":"3-ee9319f1429276a6043e137794cd4109","time":{"created":"2024-04-06T07:48:24.558Z","0.1.11":"2024-04-06T07:46:34.489Z","modified":"2024-04-06T07:48:25.014Z","0.0.1":"2024-04-06T07:48:24.804Z"},"_id":"@eerengine/react-native-thermal-receipt-printer-image-qr","name":"@eerengine/react-native-thermal-receipt-printer-image-qr","dist-tags":{"latest":"0.0.1"},"versions":{"0.0.1":{"name":"@eerengine/react-native-thermal-receipt-printer-image-qr","version":"0.0.1","description":"Fork of https://github.com/thiendangit/react-native-thermal-receipt-printer-image-qr. A React Native Library to support USB/BLE/Net printer","main":"dist/index.js","source":"dist/index.js","scripts":{"pods":"cd example && pod-install --quiet","example":"yarn --cwd example","bootstrap":"yarn example && yarn && yarn pods","build":"rimraf ./dist && tsc","test":"jshint hello.js"},"repository":{"type":"git","url":"git+https://github.com/eerengine/react-native-thermal-receipt-printer-image-qr.git"},"keywords":["react-native","thermal","printer","bluetooth","net","printer","rn","android","image","qr","base64","receipt","bill","invoice"],"dependencies":{"buffer":"^5.6.0","iconv-lite":"^0.6.2","string_decoder":"^1.3.0"},"devDependencies":{"@types/jest":"^26.0.10","@types/node":"^14.6.0","@types/react":"^16.9.46","@types/react-native":"^0.63.9","@types/react-test-renderer":"^16.9.3","jshint":"^2.13.1","pod-install":"^0.1.10","react":"^16.13.1","react-native":"^0.64.1","rimraf":"^3.0.2","typescript":"^4.0.2"},"homepage":"https://github.com/eerengine/react-native-thermal-receipt-printer-image-qr#readme","license":"ISC","_id":"@eerengine/react-native-thermal-receipt-printer-image-qr@0.0.1","gitHead":"8788a7610bccbda63cd63268a52e8cf8022805b8","types":"./dist/index.d.ts","bugs":{"url":"https://github.com/eerengine/react-native-thermal-receipt-printer-image-qr/issues"},"_nodeVersion":"18.19.1","_npmVersion":"10.4.0","dist":{"integrity":"sha512-j20fX6yaH3EmUDp0P3AnUiECos4Icb+djOrApbqJAa1gkBlPPYmBt7+XLFUNXE/i59hWhkY5aOkOQSfEkgfCXw==","shasum":"aee11cd197ae94636ce77a8ebe863663921556d6","tarball":"https://registry.npmjs.org/@eerengine/react-native-thermal-receipt-printer-image-qr/-/react-native-thermal-receipt-printer-image-qr-0.0.1.tgz","fileCount":57,"unpackedSize":6255729,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEMFqd9j5ZGStfZctumGwKumT+rHkqFFYRaGkIrwyWuPAiBg0xVCQLbe45VdaFcTsiU29zVw03iA9OTpSS2vEhcMKQ=="}]},"_npmUser":{"name":"eerengine","email":"eer.engine.22@gmail.com"},"directories":{},"maintainers":[{"name":"eerengine","email":"eer.engine.22@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-native-thermal-receipt-printer-image-qr_0.0.1_1712389704632_0.36949371555027977"},"_hasShrinkwrap":false}},"maintainers":[{"name":"eerengine","email":"eer.engine.22@gmail.com"}],"description":"Fork of https://github.com/thiendangit/react-native-thermal-receipt-printer-image-qr. A React Native Library to support USB/BLE/Net printer","homepage":"https://github.com/eerengine/react-native-thermal-receipt-printer-image-qr#readme","keywords":["react-native","thermal","printer","bluetooth","net","printer","rn","android","image","qr","base64","receipt","bill","invoice"],"repository":{"type":"git","url":"git+https://github.com/eerengine/react-native-thermal-receipt-printer-image-qr.git"},"bugs":{"url":"https://github.com/eerengine/react-native-thermal-receipt-printer-image-qr/issues"},"license":"ISC","readme":"# react-native-thermal-receipt-printer-image-qr\n\n![npm](https://img.shields.io/npm/dw/react-native-thermal-receipt-printer-image-qr?logo=github)\n![npm](https://img.shields.io/npm/v/react-native-thermal-receipt-printer-image-qr?color=green&logo=npm&logoColor=green)\n\n- I forked this for my quickly project, this is not the official project.\n- Fork of [`react-native-thermal-receipt-printer`](https://www.npmjs.com/package/react-native-thermal-receipt-printer) and add implement :\n  <br />\n\n| Implement                 | Android            | IOS                |\n| ------------------------- | ------------------ | ------------------ |\n| Image & QR (URL & Base64) | :heavy_check_mark: | :heavy_check_mark: |\n| Fix cut                   | :heavy_check_mark: | :heavy_check_mark: |\n| Print With Column         | :heavy_check_mark: | :heavy_check_mark: |\n| NET Connect Timeout       | :heavy_check_mark: | :heavy_check_mark: |\n\n:grey_exclamation:**`Print Image & QR with bluetooth in IOS just implement not tested yet`**\n\n## Support\n\n| Printer    | Android            | IOS                |\n| ---------- | ------------------ | ------------------ |\n| USBPrinter | :heavy_check_mark: |                    |\n| BLEPrinter | :heavy_check_mark: | :heavy_check_mark: |\n| NetPrinter | :heavy_check_mark: | :heavy_check_mark: |\n\n<br />\n<div style=\"display: flex; flex-direction: row; align-self: center; align-items: center\">\n<img src=\"image/invoice.jpg\" alt=\"bill\" width=\"270\" height=\"580\"/>\n<img src=\"image/_screenshot.jpg\" alt=\"screenshot\" width=\"270\" height=\"580\"/>\n</div>\n\n## Installation\n\n```\nnpm i react-native-thermal-receipt-printer-image-qr\nnpm i react-native-ping\n```\n\nor\n\n```\nyarn add react-native-thermal-receipt-printer-image-qr\nyarn add react-native-ping\n```\n\nnext step\n\n```\n# RN >= 0.60\ncd ios && pod install\n\n# RN < 0.60\nreact-native link react-native-thermal-receipt-printer-image-qr\n```\n\n## API Reference\n\n```tsx\n    init: () => Promise;\n    getDeviceList: () => Promise;\n    /**\n     * `timeout`\n     * @default 4000ms\n     */\n    connectPrinter: (host: string, port: number, timeout?: number | undefined) => Promise;\n    closeConn: () => Promise;\n    /**\n     * Print text\n     */\n    printText: (text: string, opts?: {}) => void;\n    /**\n     * Print text & end the bill & cut\n     */\n    printBill: (text: string, opts?: PrinterOptions) => void;\n    /**\n     * print with image url\n     */\n    printImage: (imgUrl: string, opts?: PrinterImageOptions) => void;\n    /**\n     * Base 64 string\n     */\n    printImageBase64: (Base64: string, opts?: PrinterImageOptions) => void;\n    /**\n     * Only android print with encoder\n     */\n    printRaw: (text: string) => void;\n    /**\n     * print column\n     * 80mm => 46 character\n     * 58mm => 30 character\n     */\n    printColumnsText: (texts: string[], columnWidth: number[], columnAlignment: ColumnAlignment[], columnStyle?: string[], opts?: PrinterOptions) => void;\n```\n\n## Styling\n\n```js\nimport {\n  COMMANDS,\n  ColumnAlignment,\n} from \"react-native-thermal-receipt-printer-image-qr\";\n```\n\n[See more here](https://github.com/thiendangit/react-native-thermal-receipt-printer-image-qr/blob/main/dist/utils/printer-commands.js)\n\n## Example\n\n**`Print Columns Text`**\n\n```tsx\nconst BOLD_ON = COMMANDS.TEXT_FORMAT.TXT_BOLD_ON;\nconst BOLD_OFF = COMMANDS.TEXT_FORMAT.TXT_BOLD_OFF;\nlet orderList = [\n  [\"1. Skirt Palas Labuh Muslimah Fashion\", \"x2\", \"500$\"],\n  [\"2. BLOUSE ROPOL VIRAL MUSLIMAH FASHION\", \"x4222\", \"500$\"],\n  [\n    \"3. Women Crew Neck Button Down Ruffle Collar Loose Blouse\",\n    \"x1\",\n    \"30000000000000$\",\n  ],\n  [\"4. Retro Buttons Up Full Sleeve Loose\", \"x10\", \"200$\"],\n  [\"5. Retro Buttons Up\", \"x10\", \"200$\"],\n];\nlet columnAlignment = [\n  ColumnAlignment.LEFT,\n  ColumnAlignment.CENTER,\n  ColumnAlignment.RIGHT,\n];\nlet columnWidth = [46 - (7 + 12), 7, 12];\nconst header = [\"Product list\", \"Qty\", \"Price\"];\nPrinter.printColumnsText(header, columnWidth, columnAlignment, [\n  `${BOLD_ON}`,\n  \"\",\n  \"\",\n]);\nfor (let i in orderList) {\n  Printer.printColumnsText(orderList[i], columnWidth, columnAlignment, [\n    `${BOLD_OFF}`,\n    \"\",\n    \"\",\n  ]);\n}\nPrinter.printBill(`${CENTER}Thank you\\n`);\n```\n\n**`Print image`**\n\n```tsx\nPrinter.printImage(\n  \"https://media-cdn.tripadvisor.com/media/photo-m/1280/1b/3a/bd/b5/the-food-bill.jpg\",\n  {\n    imageWidth: 575,\n    // imageHeight: 1000,\n    // paddingX: 100\n  }\n);\n```\n\n[See more here](https://github.com/thiendangit/react-native-thermal-receipt-printer-image-qr/blob/main/example/src/HomeScreen.tsx)\n\n## Troubleshoot\n\n- When installing `react-native` version >= 0.60, XCode shows this error:\n\n```\nduplicate symbols for architecture x86_64\n```\n\nThat's because the .a library uses [CocoaAsyncSocket](https://github.com/robbiehanson/CocoaAsyncSocket) library and Flipper uses it too.\n\n_Podfile_\n\n```diff\n...\n  use_native_modules!\n\n  # Enables Flipper.\n  #\n  # Note that if you have use_frameworks! enabled, Flipper will not work and\n  # you should disable these next few lines.\n  # add_flipper_pods!\n  # post_install do |installer|\n  #   flipper_post_install(installer)\n  # end\n...\n```\n\nand comment out code related to Flipper in `ios/AppDelegate.m`\n","readmeFilename":"README.md"}