{"_id":"@4keys/escpos","_rev":"1-a9ece8b32023f12bfd78c683dccdeddd","name":"@4keys/escpos","dist-tags":{"latest":"2.4.9"},"versions":{"2.4.9":{"name":"@4keys/escpos","version":"2.4.9","description":"ESC/POS Printer driver for nodejs","main":"index.js","scripts":{"test":"mocha","start":"node server.js"},"repository":{"type":"git","url":"git+https://github.com/song940/node-escpos.git"},"keywords":["escpos","printer"],"author":{"name":"lsong"},"contributors":[{"name":"Jose Vera","email":"hola@jose.com.co"},{"name":"Sébastien Vidal","email":"Psychopoulet@GitHub.com"},{"name":"Yu Yongwoo","email":"uyu423@gmail.com"},{"name":"Attawit Kittikrairit","email":"atton16@gmail.com"},{"name":"Risley Lima","email":"risley@rlimainfo.com.br"}],"license":"MIT","bugs":{"url":"https://github.com/song940/node-escpos/issues"},"homepage":"https://github.com/song940/node-escpos#readme","dependencies":{"iconv-lite":"*","mutable-buffer":"^2.0.3","get-pixels":"*","qr-image":"*","usb":"*"},"optionalDependencies":{"get-pixels":"*","qr-image":"*","usb":"*"},"devDependencies":{"mocha":"*"},"engines":{"node":">=8.x"},"gitHead":"0c3b6ddb61a065def094afe06329dc03f22e6703","_id":"@4keys/escpos@2.4.9","_npmVersion":"6.4.1","_nodeVersion":"8.12.0","_npmUser":{"name":"saintplay","email":"saintplay96@gmail.com"},"dist":{"integrity":"sha512-+CKD5hAGduiqCE2cy+g+CXZHDVqpUA5h7NBGt/yOHxc+bS+egHiHZ2El0rwkUlIJJxtCCGKvwLWjcctyvhaqxw==","shasum":"841dde6526cbfb2257c81fe6e5ce0bf3e00107f5","tarball":"https://registry.npmjs.org/@4keys/escpos/-/escpos-2.4.9.tgz","fileCount":18,"unpackedSize":82199,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbr73hCRA9TVsSAnZWagAALCgQAKTweWiHRZ4hsvIPdxZK\nRJo2vWaUj25XlA0p/PuQ3UNM4ci11g7UAwr+RnYVYAPlvfjQhK/IgQDnlN0Z\nmgPnrx5Jp4XZ+P+nvLFATuYpzDFRCrsEMUtjfoc0LMU1OOnspSeB2C8lni9D\n2jYzVumrUfPC6vaMdmf175d7rQaAV4VxP/Llqi2kfR0z4Gkp8ZJhXhdXVVMU\nTnFZ2IGmmWW1R250WTlkq9FL/QSYWy5pp5aCyc2290bBNNo2Bi7gInMbSLer\nonFJXR3m5QpgESCoDOIDOYC7H8vXCE/105vUmxF/NsyakYXu9OC/l/JUHAOM\nlE4bzYn2xpjuIpyYvhm6ckWlJX5iYrgqqFnA9HQAEmFoqXkikSsoYqImN6xE\nD5elhz6tyo0SU3G9iAQyudtvJA9feRTJglkw5yUKP8zNAcDN+vJCSACzhm1k\niBZqdZszjvM9jqjGYPFLVYZXZ9KRd48esbHDvuuRlc5YaRrKhllx0nW3naos\nGqzCCBCjsnr96Z/kSUiVqs/jskBVHgpEIxT24/vk5z6SvPiNa5BnmMqkDIHy\nwAX/LBQqyu+5sS1Gf63fj1kspWiUovu+9v1Svgo6+ZXoETu2v2atG3Bt0D7N\nryUF2yNHTWk5edabMGGS4+IA6sABxkBF8PgCLdRKZLNkvo/Z0jKEIcDDHvuo\n/nol\r\n=VEZV\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCHy0z12560+FEeJMdnq0jmyitJKzgXqJ9DYCJ9s+ci1gIhAMIqYPrs6BgSbz/IqNkeYsFy1w62Dsmh9qDo5zbJO2I/"}]},"maintainers":[{"name":"saintplay","email":"saintplay96@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/escpos_2.4.9_1538244064318_0.46426966188025176"},"_hasShrinkwrap":false}},"time":{"created":"2018-09-29T18:01:04.279Z","2.4.9":"2018-09-29T18:01:04.532Z","modified":"2022-04-04T10:47:05.661Z"},"maintainers":[{"name":"saintplay","email":"saintplay96@gmail.com"}],"description":"ESC/POS Printer driver for nodejs","homepage":"https://github.com/song940/node-escpos#readme","keywords":["escpos","printer"],"repository":{"type":"git","url":"git+https://github.com/song940/node-escpos.git"},"contributors":[{"name":"Jose Vera","email":"hola@jose.com.co"},{"name":"Sébastien Vidal","email":"Psychopoulet@GitHub.com"},{"name":"Yu Yongwoo","email":"uyu423@gmail.com"},{"name":"Attawit Kittikrairit","email":"atton16@gmail.com"},{"name":"Risley Lima","email":"risley@rlimainfo.com.br"}],"author":{"name":"lsong"},"bugs":{"url":"https://github.com/song940/node-escpos/issues"},"license":"MIT","readme":"# ESCPOS [![npm version](https://badge.fury.io/js/escpos.svg)](https://www.npmjs.com/package/escpos )\r\n\r\nESC/POS Printer driver for node\r\n\r\n[![NPM](https://nodei.co/npm/escpos.png?downloads=true&downloadRank=true&stars=true)](https://npmjs.org/escpos )\r\n\r\n## Installation\r\n\r\n### npm\r\n```bash\r\n$ npm i escpos --save\r\n```\r\n\r\n### yarn\r\n```bash\r\n$ yarn add escpos\r\n```\r\n\r\nif you use usb as an adapter :\r\n\r\n+ On Linux, you'll need `libudev` to build libusb.\r\n+ On Ubuntu/Debian: `sudo apt-get install build-essential libudev-dev`.\r\n+ On Windows, Use [Zadig](http://sourceforge.net/projects/libwdi/files/zadig/) to install the WinUSB driver for your USB device.\r\n\r\nOtherwise you will get `LIBUSB_ERROR_NOT_SUPPORTED` when attempting to open devices.\r\n\r\n## Example\r\n\r\n````javascript\r\nconst escpos = require('escpos');\r\n\r\n// Select the adapter based on your printer type\r\nconst device  = new escpos.USB();\r\n// const device  = new escpos.Network('localhost');\r\n// const device  = new escpos.Serial('/dev/usb/lp0');\r\n\r\nconst options = { encoding: \"GB18030\" /* default */ }\r\n// encoding is optional\r\n\r\nconst printer = new escpos.Printer(device, options);\r\n\r\n\r\n\r\ndevice.open(function(){\r\n  printer\r\n  .font('a')\r\n  .align('ct')\r\n  .style('bu')\r\n  .size(1, 1)\r\n  .text('The quick brown fox jumps over the lazy dog')\r\n  .text('敏捷的棕色狐狸跳过懒狗')\r\n  .barcode('1234567', 'EAN8')\r\n  .qrimage('https://github.com/song940/node-escpos', function(err){\r\n    this.cut();\r\n    this.close();\r\n  });\r\n});\r\n````\r\n- See `./examples` for more examples.\r\n\r\n----\r\n## Adapter\r\n\r\n### Constructors\r\n\r\nYou can choose your adapter type as USB, Serial, Network, or Console.\r\n\r\n#### USB(vid, pid)\r\n```javascript\r\nconst usbDevice = new escpos.USB(0x01, 0xff);\r\n```\r\nvid(Vendor Id) and pid (Product Id) can be checked with the `lsusb` command or `escpos.USB.findPrinter()` method.\r\n\r\n#### Serial(\"port\", options)\r\n```javascript\r\nconst serialDeviceOnWindows = new escpos.Serial('COM10');\r\nconst serialDeviceOnLinux = new escpos.Serial('/dev/usb/lp0', {\r\n  baudRate: 14400,\r\n  stopBit: 2\r\n});\r\n```\r\nCheck the [serialport package documentation](https://github.com/EmergingTechnologyAdvisors/node-serialport#serialportopenoptions--object) for more options.\r\n\r\n\r\n#### Network(address, port = 9100)\r\n```javascript\r\nconst networkDevice = new escpos.Network('localhost', 3000);\r\n```\r\nThe default port number is 9100.\r\n\r\n#### Console(handler = stdout)\r\n```javascript\r\nconst debugDevice = new escpos.Console();\r\n```\r\n\r\n### Methods\r\n\r\n#### open(function callback)\r\n\r\nClaims the current device USB (or other device type), if the printer is already in use by other process this will fail.\r\n\r\nBy default, the USB adapter will set the first printer found .\r\n\r\nTriggers the callback function when done.\r\n\r\n#### close(function callback)\r\n\r\nCloses the current device and releases its USB interface.\r\n\r\n----\r\n\r\n## Printer\r\n\r\n### Constructors\r\n\r\n#### Printer(device)\r\n\r\n```javascript\r\nconst usbDevice = new escpos.USB();\r\nconst usbPrinter = new escpos.Printer(usbDevice);\r\n\r\nconst serialDevice = new escpos.Serial('/dev/usb/lp0');\r\nconst serialPrinter = new escpos.Printer(serialDevice);\r\n\r\nconst networkDevice = new escpos.Network('localhost');\r\nconst networkPrinter = new escpos.Printer(networkDevice);\r\n```\r\n\r\n### Methods\r\n\r\nEscpos inherits its methods to the printers. the following methods are defined:\r\n\r\n#### text(\"text\", encodeType)\r\n\r\nPrints raw text. Raises TextError exception.\r\n\r\nFor the encode type, see the [iconv-lite wiki document](https://github.com/ashtuchkin/iconv-lite/wiki/Supported-Encodings). Escpos uses `iconv-lite` for encoding.\r\n\r\nIf the type is undefined, the default type is GB18030.\r\n\r\n#### encode(\"encodeType\")\r\n\r\nSets the encoding value globally. default type is GB18030 (Chinese)\r\n\r\n```javascript\r\nprinter\r\n.encode('EUC-KR')\r\n.text('동해물과 백두산이 마르고 닳도록');\r\n```\r\n\r\n#### control(\"align\")\r\n\r\nCarrier feed and tabs.\r\n\r\nalign is a string which takes any of the following values:\r\n\r\n+ LF for Line Feed\r\n+ FF for Form Feed\r\n+ CR for Carriage Return\r\n+ HT for Horizontal Tab\r\n+ VT for Vertical Tab\r\n\r\n\r\n#### align(\"align\")\r\n\r\nSet text properties.\r\n\r\nalign set horizontal position for text, the possible values are:\r\n\r\n+ CT is the Center alignment\r\n+ LT is the Left alignment\r\n+ RT is the Right alignment\r\n\r\nDefault: LT\r\n\r\n#### font(\"type\")\r\nfont type could be A or B. Default: A\r\n\r\n#### size(width, heigth)\r\n\r\nwidth is a numeric value, 1 is for regular size, and 2 is twice the standard size. Default: 1\r\n\r\nheight is a numeric value, 1 is for regular size and 2 is twice the standard size. Default: 1\r\n\r\n\r\n\r\n#### barcode(\"code\", \"barcodeType\", \"options\")\r\n\r\nPrints a barcode.\r\n\r\n\"code\" is an alphanumeric code to be printed as bar code\r\n\"barcodeType\" must be one of the following type of codes:\r\n\r\n+ UPC-A\r\n+ UPC-E\r\n+ EAN13\r\n+ EAN8\r\n+ CODE39\r\n+ ITF\r\n+ NW7\r\n\r\nThe EAN type automatically calculates the last parity bit. For the EAN13 type, the length of the string is limited to 12, and EAN8 is limited to 7. (#57)\r\nIf you wish to disable the parity bit you must set `\"includeParity\": false` in the options provided to the command.\r\n\r\n**\"options\"**\r\n\r\n\"options.width\" is a numeric value in the range between (1,255) Default: 64\r\n\r\n\"options.height\" is a numeric value in the range between (2,6) Default: 3\r\n\r\n\"options.includeParity\" is a boolean that defined if the parityBit shall be calculated to EAN13/EAN8 printers. default: true\r\n\r\n\"options.position\" is where to place the code around the bars, could be one of the following values:\r\n\r\n+ ABOVE\r\n+ BELOW\r\n+ BOTH\r\n+ OFF\r\n\r\nDefault: BELOW\r\n\r\nfont is one of the 2 type of fonts, values could be:\r\n\r\n+ A\r\n+ B\r\n\r\nDefault: A\r\n\r\nRaises BarcodeTypeError, BarcodeSizeError, BarcodeCodeError exceptions.\r\n\r\nFor backward compatibility the old method interface is still supported:\r\n\r\n ```\r\n  barcode(\"code\", \"barcodeType\", width, height, \"position\", \"font\")\r\n  ```\r\n\r\n\r\n\r\n\r\n#### cut(\"mode\")\r\n\r\nCut paper.\r\n\r\nmode set a full or partial cut. Default: full\r\nPartial cut is not implemented in all printers.\r\n\r\n*** Don't foget this, because cut will flush buffer to printer ***\r\n\r\n#### cashdraw(pin)\r\n\r\nSends a pulse to the cash drawer in the specified pin.\r\n\r\npin is a numeric value which defines the pin to be used to send the pulse, it could be 2 or 5.\r\nRaises `CashDrawerError()``\r\n\r\n----\r\n\r\n## Screencast\r\n\r\n![img_1031](https://user-images.githubusercontent.com/8033320/29250339-d66ce470-807b-11e7-89ce-9962da88ca18.JPG)\r\n\r\n----\r\n\r\n## Thanks\r\n\r\n+ [Tao Yuan](https://github.com/taoyuan)\r\n+ [Jose Vera](https://github.com/jor3l)\r\n+ [Sébastien Vidal](https://github.com/Psychopoulet)\r\n+ [Yu Yongwoo](https://github.com/uyu423)\r\n+ [Attawit Kittikrairit](https://github.com/atton16)\r\n\r\n----\r\n\r\n## Contributing\r\n- Fork this repo\r\n- Clone your repo\r\n- Install dependencies\r\n- Checkout a feature branch\r\n- Feel free to add your features\r\n- Make sure your features are fully tested\r\n- Open a pull request, and enjoy <3\r\n\r\n----\r\n\r\n### MIT license\r\nCopyright (c) 2015 lsong\r\n\r\nPermission is hereby granted, free of charge, to any person obtaining a copy\r\nof this software and associated documentation files (the &quot;Software&quot;), to deal\r\nin the Software without restriction, including without limitation the rights\r\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\ncopies of the Software, and to permit persons to whom the Software is\r\nfurnished to do so, subject to the following conditions:\r\n\r\nThe above copyright notice and this permission notice shall be included in\r\nall copies or substantial portions of the Software.\r\n\r\nTHE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\nTHE SOFTWARE.\r\n\r\n---\r\n","readmeFilename":"README.md"}