Latest 0.1.0
Homepage https://github.com/LiuSky/XBPrintInstruction
License MIT
Platforms ios 9.0
Authors

CI Status
Version
License
Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

XBPrintInstruction is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'XBPrintInstruction'

Usage

1.BluetoothManagerCode: 

var bluetoothManager = XBBluetoothManager() //初始化
bluetoothManager.delegate = self  //设置代理 
bluetoothManager.startScan() //搜索附近的蓝牙设备  
bluetoothManager.connectPeripheral(peripheral) //连接蓝牙设备 

2. ESC-POS Instruction: 

//初始化打印机
var printerInitialize: NSData! {
get { 
let cmmData = NSMutableData.init() 
cmmData.appendByte(27) 
cmmData.appendByte(64) 
return cmmData   } 
} 

3. 发送打印指令: 
let cfEnc = CFStringEncodings.GB_18030_2000 
let enc = CFStringConvertEncodingToNSStringEncoding(CFStringEncoding(cfEnc.rawValue)) 

//打印商家名称 
let cmmStoreNameData = NSMutableData.init() 
cmmStoreNameData.appendData(printerInitialize) 
cmmStoreNameData.appendData(printerModel(0)) 
cmmStoreNameData.appendData(printerCharacterSize(1)) 
cmmStoreNameData.appendData(printerAlignment(1)) 
let storeNameData = printTemplate.storeName.dataUsingEncoding(enc) 
cmmStoreNameData.appendData(storeNameData!) 
cmmStoreNameData.appendData(printerPaperFeed(2)) 
bluetoothManager.writeValue(peripheral, data: cmmStoreNameData) 

License

XBPrintInstruction is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "XBPrintInstruction",
    "version": "0.1.0",
    "summary": "u84ddu7259u6253u5370u673au6307u4ee4esc-pos",
    "homepage": "https://github.com/LiuSky/XBPrintInstruction",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Sky": "[email protected]"
    },
    "source": {
        "git": "https://github.com/LiuSky/XBPrintInstruction.git",
        "tag": "0.1.0"
    },
    "platforms": {
        "ios": "9.0"
    },
    "swift_version": "4.2",
    "source_files": "XBPrintInstruction/Classes/**/*"
}

Pin It on Pinterest

Share This