{"_id":"@camiloarc/react-native-bluetooth-escpos-printer","_rev":"2-8eb79a7d981b4ccd4310ae9e0d475183","name":"@camiloarc/react-native-bluetooth-escpos-printer","description":"React-Native plugin for the bluetooth ESC/POS printers.","dist-tags":{"latest":"0.0.8"},"versions":{"0.0.6":{"name":"@camiloarc/react-native-bluetooth-escpos-printer","version":"0.0.6","keywords":["react-native","ESC","POS","Bluetooth","Printer"],"author":{"name":"janus j k lu"},"license":"MIT","_id":"@camiloarc/react-native-bluetooth-escpos-printer@0.0.6","homepage":"https://github.com/CamiloARC/react-native-bluetooth-escpos-printer#readme","bugs":{"url":"https://github.com/CamiloARC/react-native-bluetooth-escpos-printer/issues"},"dist":{"shasum":"32d243b732d8d2daa76c92066d85ca90454108ad","tarball":"https://registry.npmjs.org/@camiloarc/react-native-bluetooth-escpos-printer/-/react-native-bluetooth-escpos-printer-0.0.6.tgz","fileCount":515,"integrity":"sha512-rKrO3QPssEkCpdtR14A1E6eM8zTnnYq6F5xGwq7pZ4gLy+wtLWLK3wxl38TH/p5vwmoInA03yDAQPCa6/kwWZA==","signatures":[{"sig":"MEYCIQC2/W5Ngik4dtZpFFl+97yQN6eilR2mZY2SC3kXl+rrpAIhAPwzJv4GqKzbDJBRh0tnTS+vpO/Vk4Fc4ctmEpyjOaeL","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2745107},"main":"index.js","gitHead":"689b754599bf0534dc6bb2338fd7404ad20bb953","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"camiloarc","email":"camilo._car@hotmail.com"},"repository":{"url":"git+https://github.com/CamiloARC/react-native-bluetooth-escpos-printer.git","type":"git"},"_npmVersion":"9.5.1","description":"React-Native plugin for the bluetooth ESC/POS printers.","directories":{"doc":"docs","example":"examples"},"_nodeVersion":"18.16.1","_hasShrinkwrap":false,"peerDependencies":{"react-native":">=0.55.4"},"_npmOperationalInternal":{"tmp":"tmp/react-native-bluetooth-escpos-printer_0.0.6_1719192216068_0.8390541467382489","host":"s3://npm-registry-packages"}},"0.0.7":{"name":"@camiloarc/react-native-bluetooth-escpos-printer","version":"0.0.7","keywords":["react-native","ESC","POS","Bluetooth","Printer"],"author":{"name":"janus j k lu"},"license":"MIT","_id":"@camiloarc/react-native-bluetooth-escpos-printer@0.0.7","homepage":"https://github.com/CamiloARC/react-native-bluetooth-escpos-printer#readme","bugs":{"url":"https://github.com/CamiloARC/react-native-bluetooth-escpos-printer/issues"},"dist":{"shasum":"c39b7a22162969ff31998f3e18833cb3d6420836","tarball":"https://registry.npmjs.org/@camiloarc/react-native-bluetooth-escpos-printer/-/react-native-bluetooth-escpos-printer-0.0.7.tgz","fileCount":515,"integrity":"sha512-TofdxXIcwwy5Hzgkg83M8oEdq/x2SIFpew25SEQSoSnVwlECBx7JSc3msNMJZ38GQ0Arz5S1blX7xl66rs5KtQ==","signatures":[{"sig":"MEUCIAePJvF1J1lm4g/TbYUfSiVdDDX8xEDeDFjwBTkXXUXjAiEA7mAwoP8oabTO8MyR7bsOvufxjrUbfEaB+OOnj4kOqL8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2745151},"main":"index.js","gitHead":"ccac27e40a029a91d90092988193f4ccf32cf617","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"camiloarc","email":"camilo._car@hotmail.com"},"repository":{"url":"git+https://github.com/CamiloARC/react-native-bluetooth-escpos-printer.git","type":"git"},"_npmVersion":"9.5.1","description":"React-Native plugin for the bluetooth ESC/POS printers.","directories":{"doc":"docs","example":"examples"},"_nodeVersion":"18.16.1","_hasShrinkwrap":false,"peerDependencies":{"react-native":">=0.55.4"},"_npmOperationalInternal":{"tmp":"tmp/react-native-bluetooth-escpos-printer_0.0.7_1719193077832_0.24108093718186474","host":"s3://npm-registry-packages"}},"0.0.8":{"name":"@camiloarc/react-native-bluetooth-escpos-printer","version":"0.0.8","description":"React-Native plugin for the bluetooth ESC/POS printers.","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"keywords":["react-native","ESC","POS","Bluetooth","Printer"],"author":{"name":"janus j k lu"},"license":"MIT","peerDependencies":{"react-native":">=0.55.4"},"directories":{"doc":"docs","example":"examples"},"repository":{"type":"git","url":"git+https://github.com/CamiloARC/react-native-bluetooth-escpos-printer.git"},"bugs":{"url":"https://github.com/CamiloARC/react-native-bluetooth-escpos-printer/issues"},"homepage":"https://github.com/CamiloARC/react-native-bluetooth-escpos-printer#readme","gitHead":"0da669f0b0c40b273ada3dae3a81ad175001bf43","_id":"@camiloarc/react-native-bluetooth-escpos-printer@0.0.8","_nodeVersion":"18.16.1","_npmVersion":"9.5.1","dist":{"integrity":"sha512-oIa6/6rUMHpBc58IriFEYBZsz0eDPK1PUBawNiPlxMODD9jykrd2jxpc0wYaxY/ToAPj3qKMYo4kR0cPl2KhcQ==","shasum":"0f8393752c3b252bd1628d57f721ef557ea6b87a","tarball":"https://registry.npmjs.org/@camiloarc/react-native-bluetooth-escpos-printer/-/react-native-bluetooth-escpos-printer-0.0.8.tgz","fileCount":515,"unpackedSize":2745183,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDZHzAhiDTl1R7zCtP/WWNYJT7wCgNlCLS7s/Du0oyx9wIhAIqzI660WhNCnqWoD/cYbZIsg6z9Ezk9HhN80fH5ZpYg"}]},"_npmUser":{"name":"camiloarc","email":"camilo._car@hotmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-native-bluetooth-escpos-printer_0.0.8_1719194151340_0.6471421536836144"},"_hasShrinkwrap":false}},"time":{"created":"2024-06-24T01:23:35.943Z","modified":"2024-06-24T01:55:51.712Z","0.0.6":"2024-06-24T01:23:36.368Z","0.0.7":"2024-06-24T01:37:58.060Z","0.0.8":"2024-06-24T01:55:51.551Z"},"maintainers":[{"name":"camiloarc","email":"camilo._car@hotmail.com"}],"author":{"name":"janus j k lu"},"repository":{"type":"git","url":"git+https://github.com/CamiloARC/react-native-bluetooth-escpos-printer.git"},"keywords":["react-native","ESC","POS","Bluetooth","Printer"],"license":"MIT","homepage":"https://github.com/CamiloARC/react-native-bluetooth-escpos-printer#readme","bugs":{"url":"https://github.com/CamiloARC/react-native-bluetooth-escpos-printer/issues"},"readme":"# react-native-bluetooch-escpos-printer\r\n\r\nReact-Native plugin for the bluetooth ESC/POS & TSC printers.\r\n\r\nAny questions or bug please raise a issue.\r\n\r\n##Still under developement\r\n\r\n#May support Android /IOS\r\n\r\n[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/januslo/react-native-bluetooth-escpos-printer/master/LICENSE) [![npm version](https://badge.fury.io/js/react-native-bluetooth-escpos-printer.svg)](https://www.npmjs.com/package/react-native-bluetooth-escpos-printer)\r\n\r\n## Installation\r\n### Step 1 ###\r\nInstall via NPM [Check In NPM](https://www.npmjs.com/package/react-native-bluetooth-escpos-printer)\r\n```bash\r\nnpm install @camiloarc/react-native-bluetooth-escpos-printer --save\r\n```\r\n\r\nOr install via github\r\n```bash\r\nnpm install https://github.com/CamiloARC/react-native-bluetooth-escpos-printer.git --save\r\n```\r\n\r\n### Step2 ###\r\nLink the plugin to your RN project\r\n```bash\r\nreact-native link @camiloarc/react-native-bluetooth-escpos-printer\r\n```\r\n\r\n### Manual linking (Android) ###\r\nEnsure your build files match the following requirements:\r\n\r\n1. (React Native 0.59 and lower) Define the *`react-native-bluetooth-escpos-printer`* project in *`android/settings.gradle`*:\r\n\r\n```\r\ninclude ':camiloarc_react-native-bluetooth-escpos-printer'\r\nproject(':camiloarc_react-native-bluetooth-escpos-printer').projectDir = new File(rootProject.projectDir, '../node_modules/@camiloarc/react-native-bluetooth-escpos-printer/android')\r\n```\r\n2. (React Native 0.59 and lower) Add the *`react-native-bluetooth-escpos-printer`* as an dependency of your app in *`android/app/build.gradle`*:\r\n```\r\n...\r\ndependencies {\r\n  ...\r\n  implementation project(':camiloarc_react-native-bluetooth-escpos-printer')\r\n}\r\n```\r\n\r\n3. (React Native 0.59 and lower) Add *`import cn.jystudio.bluetooth.RNBluetoothEscposPrinterPackage;`* and *`new RNBluetoothEscposPrinterPackage()`* in your *`MainApplication.java`* :\r\n\r\n\r\n\r\n### Step3 ###\r\nRefers to your JS files\r\n```javascript\r\n    import {BluetoothManager,BluetoothEscposPrinter,BluetoothTscPrinter} from '@camiloarc/react-native-bluetooth-escpos-printer';\r\n```\r\n\r\n## Usage and APIs ##\r\n\r\n### BluetoothManager ###\r\nBluetoothManager is the module for Bluetooth service management, supports Bluetooth status check, enable/disable Bluetooth service, scan devices, connect/unpair devices.\r\n\r\n* isBluetoothEnabled ==>\r\nasync function, checks whether Bluetooth service is enabled.\r\n//TODO: consider to return the the devices information already bound and paired here..\r\n\r\n```javascript\r\n     BluetoothManager.isBluetoothEnabled().then((enabled)=> {\r\n                alert(enabled) // enabled ==> true /false\r\n            }, (err)=> {\r\n                alert(err)\r\n            });\r\n```\r\n\r\n* enableBluetooth ==> ``` diff + ANDROID ONLY ```\r\nasync function, enables the bluetooth service, returns the devices information already bound and paired.  ``` diff - IOS would just resovle with nil ```\r\n\r\n```javascript\r\nBluetoothManager.enableBluetooth().then((r)=>{\r\n                var paired = [];\r\n                if(r && r.length>0){\r\n                    for(var i=0;i<r.length;i++){\r\n                        try{\r\n                            paired.push(JSON.parse(r[i])); // NEED TO PARSE THE DEVICE INFORMATION\r\n                        }catch(e){\r\n                            //ignore\r\n                        }\r\n                    }\r\n                }\r\n                console.log(JSON.stringify(paired))\r\n            },(err)=>{\r\n               alert(err)\r\n           });\r\n```\r\n\r\n* disableBluetooth ==>  ``` diff + ANDROID ONLY ```\r\nasync function ,disables the bluetooth service. ``` diff - IOS would just resovle with nil ```\r\n\r\n```javascript\r\nBluetoothManager.disableBluetooth().then(()=>{\r\n            // do something.\r\n          },(err)=>{alert(err)});\r\n```\r\n\r\n* scanDevices ==>\r\nasync function , scans the bluetooth devices, returns devices found and paired after scan finish. Event [BluetoothManager.EVENT_DEVICE_ALREADY_PAIRED] would be emitted with devices bound; event [BluetoothManager.EVENT_DEVICE_FOUND] would be emitted (many time) as long as new devices found.\r\n\r\nsamples with events:\r\n```javascript\r\n DeviceEventEmitter.addListener(\r\n            BluetoothManager.EVENT_DEVICE_ALREADY_PAIRED, (rsp)=> {\r\n                this._deviceAlreadPaired(rsp) // rsp.devices would returns the paired devices array in JSON string.\r\n            });\r\n        DeviceEventEmitter.addListener(\r\n            BluetoothManager.EVENT_DEVICE_FOUND, (rsp)=> {\r\n                this._deviceFoundEvent(rsp) // rsp.devices would returns the found device object in JSON string\r\n            });\r\n```\r\n\r\nsamples with scanDevices function\r\n```javascript\r\nBluetoothManager.scanDevices()\r\n            .then((s)=> {\r\n                var ss = JSON.parse(s);//JSON string\r\n                this.setState({\r\n                    pairedDs: this.state.pairedDs.cloneWithRows(ss.paired || []),\r\n                    foundDs: this.state.foundDs.cloneWithRows(ss.found || []),\r\n                    loading: false\r\n                }, ()=> {\r\n                    this.paired = ss.paired || [];\r\n                    this.found = ss.found || [];\r\n                });\r\n            }, (er)=> {\r\n                this.setState({\r\n                    loading: false\r\n                })\r\n                alert('error' + JSON.stringify(er));\r\n            });\r\n```\r\n\r\n* connect ==>\r\nasync function, connects the specified device, if not bound, bound dailog prompts.\r\n\r\n```javascript\r\n\r\n    BluetoothManager.connect(rowData.address) // the device address scanned.\r\n     .then((s)=>{\r\n       this.setState({\r\n        loading:false,\r\n        boundAddress:rowData.address\r\n    })\r\n    },(e)=>{\r\n       this.setState({\r\n         loading:false\r\n     })\r\n       alert(e);\r\n    })\r\n\r\n```\r\n\r\n* unpair ==>\r\nasync function, disconnects and unpairs the specified devices\r\n\r\n```javascript\r\n     BluetoothManager.connect(rowData.address)\r\n     .then((s)=>{\r\n        //success here\r\n     },\r\n     (err)=>{\r\n        //error here\r\n     })\r\n```\r\n\r\n* Events of BluetoothManager module\r\n\r\n| Name/KEY | DESCRIPTION |\r\n|---|---|\r\n| EVENT_DEVICE_ALREADY_PAIRED | Emits the devices array already paired |\r\n| EVENT_DEVICE_DISCOVER_DONE | Emits when the scan done |\r\n| EVENT_DEVICE_FOUND | Emits when device found during scan |\r\n| EVENT_CONNECTION_LOST | Emits when device connection lost |\r\n| EVENT_UNABLE_CONNECT | Emits when error occurs while trying to connect device |\r\n| EVENT_CONNECTED | Emits when device connected |\r\n| EVENT_BLUETOOTH_NOT_SUPPORT | Emits when device not support bluetooth(android only) |\r\n\r\n### BluetoothTscPrinter ###\r\nThe printer for label printing.\r\n\r\n* printLabel ==>\r\nasync function that performs the label print action.\r\n\r\n```javascript\r\nBluetoothTscPrinter.printLabel(options)\r\n.then(()=>{\r\n    //success\r\n},\r\n(err)=>{\r\n    //error\r\n})\r\n\r\n```\r\n\r\n#### Options of printLabel( ) function: (JSON object) ####\r\n\r\n##### width #####\r\n    label width , the real size of the label, measured by mm usually.\r\n##### height #####\r\n    label height, the real size of the label, measured by mm usually.\r\n##### direction #####\r\n    the printing direction, constants of BluetoothTscPrinter.DIRECTION, values BluetoothTscPrinter.DIRECTION.FORWARD/BluetoothTscPrinter.DIRECTION.BACKWARD (0/1)\r\n##### gap #####\r\n    the gap between 2 labels, measured by mm usually.\r\n##### reference #####\r\n    the \"zero\" position of the label, values [x,y], default [0,0]\r\n##### tear #####\r\n    switch of the paper cut, constants of BluetoothTscPrinter.TEAR, values ON/OFF (string 'ON','OFF')\r\n##### sound #####\r\n    switch of the bee sound, values 0/1\r\n##### text #####\r\n    the collection of texts to print, contains following fields as the configuration:\r\n        * text\r\n            the text string,\r\n        * x\r\n            the text print start position-x\r\n        * y\r\n            the text print start position-y\r\n        * fonttype\r\n            the font type of the text, constanst of BluetoothTscPrinter.FONTTYPE,refereces as table:\r\n                | CONSTANTS | VALUE   |\r\n                |---|---|\r\n                |FONT_1| \"1\"|\r\n                |FONT_2| \"2\"|\r\n                |FONT_3| \"3\"|\r\n                |FONT_4| \"4\"|\r\n                |FONT_5| \"5\"|\r\n                |FONT_6| \"6\"|\r\n                |FONT_7| \"7\"|\r\n                |FONT_8|\"8\"|\r\n                |SIMPLIFIED_CHINESE| \"TSS24.BF2\"|\r\n                |TRADITIONAL_CHINESE| \"TST24.BF2\"|\r\n                |KOREAN| \"K\"|\r\n        * rotation\r\n            the rotation of the text, constants of the BluetoothTscPrinter.ROTATION, referces as table:\r\n                   | CONSTANTS | VALUE   |\r\n                   |---|---|\r\n                   |ROTATION_0| 0|\r\n                   |ROTATION_90| 90|\r\n                   |ROTATION_180| 180|\r\n                   |ROTATION_270| 270|\r\n        * xscal\r\n            the scal in x,\r\n        * yscal\r\n            the scal in y, xscal/yscal is the constants of the BluetoothTscPrinter.FONTMUL, referces as table:\r\n             | CONSTANTS | VALUE   |\r\n             |---|---|\r\n             |MUL_1| 1|\r\n             |MUL_2| 2|\r\n             |MUL_3| 3|\r\n             |MUL_4| 4|\r\n             |MUL_5| 5|\r\n             |MUL_6| 6|\r\n             |MUL_7| 7|\r\n             |MUL_8| 8|\r\n             |MUL_9| 9|\r\n             |MUL_10: 10|\r\n\r\n##### qrcode #####\r\n    the collection of qrcodes to print, contains following fields as the configuration:\r\n        * code\r\n            the qrcode content string.\r\n        * x\r\n            the print start position at x\r\n        * y\r\n            the print start position at y\r\n        * level\r\n            the error correction level, constants of BluetoothTscPrinter.EEC, referces as tables:\r\n            | CONSTANTS | VALUE   |\r\n            |---|---|\r\n            |LEVEL_L|\"L\"|\r\n            |LEVEL_M| \"M\"|\r\n            |LEVEL_Q| \"Q\"|\r\n            |LEVEL_H| \"H\"|\r\n        * width\r\n            the qrcode size (width X width),since the qrcode are square normally, so we just config the width.\r\n\r\n        * rotation\r\n            rotation. the same as text object.\r\n\r\n##### barcode #####\r\n    the collection of barcode to print, contains following fields as configuration\r\n      * x\r\n        the print start position of x,\r\n      * y\r\n        the print start position of y,\r\n      * type\r\n        the barcode type, constants of BluetoothTscPrinter, definition as table:\r\n        | CONSTRANTS | VALUE |\r\n        |---|---|\r\n        | CODE128 | \"128\" |\r\n        | CODE128M | \"128M\" |\r\n        | EAN128 | \"EAN128\" |\r\n        | ITF25 | \"25\" |\r\n        | ITF25C | \"25C\" |\r\n        | CODE39 | \"39\" |\r\n        | CODE39C | \"39C\" |\r\n        | CODE39S | \"39S\" |\r\n        | CODE93 | \"93\" |\r\n        | EAN13 | \"EAN13\" |\r\n        | EAN13_2 | \"EAN13+2\" |\r\n        | EAN13_5 | \"EAN13+5\" |\r\n        | EAN8 | \"EAN8\" |\r\n        | EAN8_2 | \"EAN8+2\" |\r\n        | EAN8_5 | \"EAN8+5\" |\r\n        | CODABAR | \"CODA\" |\r\n        | POST | \"POST\" |\r\n        | UPCA | \"EAN13\" |\r\n        | UPCA_2 | \"EAN13+2\" |\r\n        | UPCA_5 | \"EAN13+5\" |\r\n        | UPCE | \"EAN13\" |\r\n        | UPCE_2 | \"EAN13+2\" |\r\n        | UPCE_5 | \"EAN13+5\" |\r\n        | CPOST | \"CPOST\" |\r\n        | MSI | \"MSI\" |\r\n        | MSIC | \"MSIC\" |\r\n        | PLESSEY | \"PLESSEY\" |\r\n        | ITF14 | \"ITF14\" |\r\n        | EAN14 | \"EAN14\" |\r\n\r\n     * height\r\n      the height of the barcode.\r\n     * readable\r\n      the human readable factor, 0-not readable, 1-readable.\r\n     * rotation\r\n      rotation, the same as text.\r\n     * code\r\n      the code to generate and print, should follow the restriction of the code type using.\r\n     * wide\r\n     the wide bar lines width (dot)\r\n     * narrow\r\n     the narrow bar line width (dot)\r\n\r\n##### image #####\r\n    the collection of the image to print.\r\n     * x\r\n     the print start position x.\r\n     * y\r\n     the print start position y.\r\n     * mode\r\n     the bitmap mode of print, constants of BluetoothTscPrinter.BITMAP_MODE, valuse OVERWRITE(0),OR(1),XOR(2).\r\n     * width\r\n     the width of the image to print. (height will be calculated by image ratio)\r\n     * image\r\n     the base64 encoded image data(without schema)\r\n\r\n#### demo of printLabel() options ####\r\n```javascript\r\nlet options = {\r\n   width: 40,\r\n   height: 30,\r\n   gap: 20,\r\n   direction: BluetoothTscPrinter.DIRECTION.FORWARD,\r\n   reference: [0, 0],\r\n   tear: BluetoothTscPrinter.TEAR.ON,\r\n   sound: 0,\r\n   text: [{\r\n       text: 'I am a testing txt',\r\n       x: 20,\r\n       y: 0,\r\n       fonttype: BluetoothTscPrinter.FONTTYPE.SIMPLIFIED_CHINESE,\r\n       rotation: BluetoothTscPrinter.ROTATION.ROTATION_0,\r\n       xscal:BluetoothTscPrinter.FONTMUL.MUL_1,\r\n       yscal: BluetoothTscPrinter.FONTMUL.MUL_1\r\n   },{\r\n       text: '你在说什么呢?',\r\n       x: 20,\r\n       y: 50,\r\n       fonttype: BluetoothTscPrinter.FONTTYPE.SIMPLIFIED_CHINESE,\r\n       rotation: BluetoothTscPrinter.ROTATION.ROTATION_0,\r\n       xscal:BluetoothTscPrinter.FONTMUL.MUL_1,\r\n       yscal: BluetoothTscPrinter.FONTMUL.MUL_1\r\n   }],\r\n   qrcode: [{x: 20, y: 96, level: BluetoothTscPrinter.EEC.LEVEL_L, width: 3, rotation: BluetoothTscPrinter.ROTATION.ROTATION_0, code: 'show me the money'}],\r\n   barcode: [{x: 120, y:96, type: BluetoothTscPrinter.BARCODETYPE.CODE128, height: 40, readable: 1, rotation: BluetoothTscPrinter.ROTATION.ROTATION_0, code: '1234567890'}],\r\n   image: [{x: 160, y: 160, mode: BluetoothTscPrinter.BITMAP_MODE.OVERWRITE,width: 60,image: base64Image}]\r\n}\r\n```\r\n### BluetoothEscposPrinter ###\r\n  the printer for receipt printing, following ESC/POS command.\r\n\r\n#### printerInit() ####\r\n  init the printer.\r\n\r\n#### printAndFeed(int feed) ####\r\n  printer the buffer data and feed (feed lines).\r\n\r\n#### printerLeftSpace(int sp) ####\r\n  set the printer left spaces.\r\n\r\n#### printerLineSpace(int sp) ####\r\n  set the spaces between lines.\r\n\r\n#### printerUnderLine(int line) ####\r\n  set the underline of the text, @param line --  0-off,1-on,2-deeper\r\n\r\n#### printerAlign(int align) ####\r\n  set the printer alignment, constansts: BluetoothEscposPrinter.ALIGN.LEFT/BluetoothEscposPrinter.ALIGN.CENTER/BluetoothEscposPrinter.ALIGN.RIGHT.\r\n  Does not work on printPic() method.\r\n\r\n#### printText(String text, ReadableMap options) ####\r\n  print text, options as following:\r\n  * encoding => text encoding,default GBK.\r\n  * codepage => codepage using, default 0.\r\n  * widthtimes => text font mul times in width, default 0.\r\n  * heigthTimes => text font mul times in height, default 0.\r\n  * fonttype => text font type, default 0.\r\n\r\n#### printColumn(ReadableArray columnWidths,ReadableArray columnAligns,ReadableArray columnTexts,ReadableMap options) ####\r\n  print texts in column, Parameters as following:\r\n  * columnWidths => int arrays, configs the width of each column, calculate by english character length. ex:the width of \"abcdef\" is 5 ,the width of \"中文\" is 4.\r\n  * columnAligns => arrays, alignment of each column, values is the same of printerAlign().\r\n  * columnTexts => arrays, the texts of each colunm to print.\r\n  * options => text print config options, the same of printText() options.\r\n\r\n#### setWidth(int width) ####\r\n  sets the width of the printer.\r\n\r\n#### printPic(String base64encodeStr,ReadableMap options) ####\r\n  prints the image which is encoded by base64, without schema.\r\n  * options: contains the params that may use in printing pic: \"width\": the pic width, basic on devices width(dots,58mm-384); \"left\": the left padding of the pic for the printing position adjustment.\r\n\r\n#### setfTest() ####\r\n  prints the self test.\r\n\r\n#### rotate() ####\r\n  sets the rotation of the line.\r\n\r\n#### setBlob(int weight) ####\r\n  sets blob of the line.\r\n\r\n#### printQRCode(String content, int size, int correctionLevel) ####\r\n  prints the qrcode.\r\n\r\n#### printBarCode(String str,int nType, int nWidthX, int nHeight, int nHriFontType, int nHriFontPosition) ####\r\n  prints the barcode.\r\n\r\n### Demos of printing a receipt ###\r\n```javascript\r\nawait BluetoothEscposPrinter.printerAlign(BluetoothEscposPrinter.ALIGN.CENTER);\r\nawait BluetoothEscposPrinter.setBlob(0);\r\nawait  BluetoothEscposPrinter.printText(\"广州俊烨\\n\\r\",{\r\n  encoding:'GBK',\r\n  codepage:0,\r\n  widthtimes:3,\r\n  heigthtimes:3,\r\n  fonttype:1\r\n});\r\nawait BluetoothEscposPrinter.setBlob(0);\r\nawait  BluetoothEscposPrinter.printText(\"销售单\\n\\r\",{\r\n  encoding:'GBK',\r\n  codepage:0,\r\n  widthtimes:0,\r\n  heigthtimes:0,\r\n  fonttype:1\r\n});\r\nawait BluetoothEscposPrinter.printerAlign(BluetoothEscposPrinter.ALIGN.LEFT);\r\nawait  BluetoothEscposPrinter.printText(\"客户：零售客户\\n\\r\",{});\r\nawait  BluetoothEscposPrinter.printText(\"单号：xsd201909210000001\\n\\r\",{});\r\nawait  BluetoothEscposPrinter.printText(\"日期：\"+(dateFormat(new Date(), \"yyyy-mm-dd h:MM:ss\"))+\"\\n\\r\",{});\r\nawait  BluetoothEscposPrinter.printText(\"销售员：18664896621\\n\\r\",{});\r\nawait  BluetoothEscposPrinter.printText(\"--------------------------------\\n\\r\",{});\r\nlet columnWidths = [12,6,6,8];\r\nawait BluetoothEscposPrinter.printColumn(columnWidths,\r\n  [BluetoothEscposPrinter.ALIGN.LEFT,BluetoothEscposPrinter.ALIGN.CENTER,BluetoothEscposPrinter.ALIGN.CENTER,BluetoothEscposPrinter.ALIGN.RIGHT],\r\n  [\"商品\",'数量','单价','金额'],{});\r\nawait BluetoothEscposPrinter.printColumn(columnWidths,\r\n  [BluetoothEscposPrinter.ALIGN.LEFT,BluetoothEscposPrinter.ALIGN.LEFT,BluetoothEscposPrinter.ALIGN.CENTER,BluetoothEscposPrinter.ALIGN.RIGHT],\r\n  [\"React-Native定制开发我是比较长的位置你稍微看看是不是这样?\",'1','32000','32000'],{});\r\n    await  BluetoothEscposPrinter.printText(\"\\n\\r\",{});\r\n  await BluetoothEscposPrinter.printColumn(columnWidths,\r\n  [BluetoothEscposPrinter.ALIGN.LEFT,BluetoothEscposPrinter.ALIGN.LEFT,BluetoothEscposPrinter.ALIGN.CENTER,BluetoothEscposPrinter.ALIGN.RIGHT],\r\n  [\"React-Native定制开发我是比较长的位置你稍微看看是不是这样?\",'1','32000','32000'],{});\r\nawait  BluetoothEscposPrinter.printText(\"\\n\\r\",{});\r\nawait  BluetoothEscposPrinter.printText(\"--------------------------------\\n\\r\",{});\r\nawait BluetoothEscposPrinter.printColumn([12,8,12],\r\n  [BluetoothEscposPrinter.ALIGN.LEFT,BluetoothEscposPrinter.ALIGN.LEFT,BluetoothEscposPrinter.ALIGN.RIGHT],\r\n  [\"合计\",'2','64000'],{});\r\nawait  BluetoothEscposPrinter.printText(\"\\n\\r\",{});\r\nawait  BluetoothEscposPrinter.printText(\"折扣率：100%\\n\\r\",{});\r\nawait  BluetoothEscposPrinter.printText(\"折扣后应收：64000.00\\n\\r\",{});\r\nawait  BluetoothEscposPrinter.printText(\"会员卡支付：0.00\\n\\r\",{});\r\nawait  BluetoothEscposPrinter.printText(\"积分抵扣：0.00\\n\\r\",{});\r\nawait  BluetoothEscposPrinter.printText(\"支付金额：64000.00\\n\\r\",{});\r\nawait  BluetoothEscposPrinter.printText(\"结算账户：现金账户\\n\\r\",{});\r\nawait  BluetoothEscposPrinter.printText(\"备注：无\\n\\r\",{});\r\nawait  BluetoothEscposPrinter.printText(\"快递单号：无\\n\\r\",{});\r\nawait  BluetoothEscposPrinter.printText(\"打印时间：\"+(dateFormat(new Date(), \"yyyy-mm-dd h:MM:ss\"))+\"\\n\\r\",{});\r\nawait  BluetoothEscposPrinter.printText(\"--------------------------------\\n\\r\",{});\r\nawait  BluetoothEscposPrinter.printText(\"电话：\\n\\r\",{});\r\nawait  BluetoothEscposPrinter.printText(\"地址:\\n\\r\\n\\r\",{});\r\nawait BluetoothEscposPrinter.printerAlign(BluetoothEscposPrinter.ALIGN.CENTER);\r\nawait  BluetoothEscposPrinter.printText(\"欢迎下次光临\\n\\r\\n\\r\\n\\r\",{});\r\nawait BluetoothEscposPrinter.printerAlign(BluetoothEscposPrinter.ALIGN.LEFT);\r\n```\r\n\r\n### Demo for opening the drawer ###\r\n```javascript\r\nBluetoothEscposPrinter.opendDrawer(0, 250, 250);\r\n```\r\n","readmeFilename":"README.md"}