javascript raspberry_pi_pos_nodejs_WORKING.js

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了javascript raspberry_pi_pos_nodejs_WORKING.js相关的知识,希望对你有一定的参考价值。

const escpos = require('escpos');
 
// Select the adapter based on your printer type
const device  = new escpos.USB();
// const device  = new escpos.Network('localhost');
// const device  = new escpos.Serial('/dev/usb/lp0');
 
const printer = new escpos.Printer(device);
 
device.open(function(){
  printer
  .font('a')
  .align('ct')
  .style('bu')
  .size(1, 1)
  .text('The quick brown fox jumps over the lazy dog')
  .text('敏捷的棕色狐狸跳过懒狗')
  .barcode('1234567', 'EAN8')
  .qrimage('https://github.com/song940/node-escpos', function(err){
    this.cut();
    this.close();
  });
});
const escpos = require('escpos');

const device  = new escpos.USB();
const printer = new escpos.Printer(device);

device.open(() => {
  printer
    .text('Hello World')
    .feed()
    .cut()
    .close(() => {
      console.log('Close')
    })
});
const escpos = require('escpos');

const device  = new escpos.USB();
const printer = new escpos.Printer(device);

device.open(() => {
  printer
    .text(' MANNIR ESYSTEMS NIGERIA LIMITED\n')
    .text('SOFTWARE & WEBSITE DEVELOPMENT COMPANY\n')
    .text('THIS IS TEST PRINT TO POS PRINTER FROM NODEJS RASPBERRY PI APPLICATION\n')
    .feed()
    .cut()
    .close(() => {
      console.log('Close')
    })
});

以上是关于javascript raspberry_pi_pos_nodejs_WORKING.js的主要内容,如果未能解决你的问题,请参考以下文章

javascript JavaScript isset()等效: - JavaScript

JavaScript 使用JavaScript更改CSS(JavaScript)

JavaScript之基础-1 JavaScript(概述基础语法)

前端基础-JavaScript的基本概述和语法

JavaScript

JavaScript