1***@qq.com
1***@qq.com
  • 发布:2017-12-20 09:47
  • 更新:2019-05-01 18:10
  • 阅读:3032

pos打印小票如何设置行间距

分类:HTML5+

pos打印机如何设置打印小票的行间距和字体(font-family)?

2017-12-20 09:47 负责人:无 分享
已邀请:
1***@126.com

1***@126.com

export class PosMachine {
constructor (ipAddr, port) {
if (plus.os.name == 'Android') {
var Socket = plus.android.importClass('java.net.Socket')
var PrintWriter = plus.android.importClass('java.io.PrintWriter')
var BufferedWriter = plus.android.importClass('java.io.BufferedWriter')
var OutputStreamWriter = plus.android.importClass('java.io.OutputStreamWriter')
var BufferedReader = plus.android.importClass('java.io.BufferedReader')
var InputStreamReader = plus.android.importClass('java.io.InputStreamReader')
var StrictMode = plus.android.importClass('android.os.StrictMode')
var Build = plus.android.importClass('android.os.Build')
if (Build.VERSION.SDK_INT > 9) {
var policy = new StrictMode.ThreadPolicy.Builder().permitAll().build()
StrictMode.setThreadPolicy(policy)
}
var socket = new Socket(ipAddr, port)

  var outputStreamWriter = new OutputStreamWriter(socket.getOutputStream(), 'gbk')  
  var bufferWriter = new BufferedWriter(outputStreamWriter)  
  this.posMaWriter = new PrintWriter(bufferWriter, true)  
}  

}
setBold (flag) {
if (flag) {
this.posMaWriter.write(0x1B)
this.posMaWriter.write(69)
this.posMaWriter.write(0xF)
} else {
this.posMaWriter.write(0x1B)
this.posMaWriter.write(69)
this.posMaWriter.write(0)
}
}

/**

  • 排版
  • @param position 0:居左(默认) 1:居中 2:居右
  • @return
  • @throws IOException
    */
    setAlign (position) {
    this.posMaWriter.write(0x1B)
    this.posMaWriter.write(97)
    this.posMaWriter.write(position)
    }
    /**
  • 字体大小
  • @param size 1-8 选择字号
  • @return
  • @throws IOException
    */
    setSize (size) {
    this.posMaWriter.write(0x1D)
    this.posMaWriter.write(33)
    this.posMaWriter.write(size)
    }
    /**
  • 进纸并全部切割
  • @return
  • @throws IOException
    */
    feedAndCut () {
    this.posMaWriter.write(0x1D)
    this.posMaWriter.write(86)
    this.posMaWriter.write(65)
    this.posMaWriter.write(0)
    this.posMaWriter.flush()
    }
    getPosHandle () {
    return this.posMaWriter
    }
    }
  • 1***@qq.com

    这个是用的uni-app么

    2019-04-12 18:46

n***@qq.com

n***@qq.com

谢谢

该问题目前已经被锁定, 无法添加新回复