Printer
Swift ticket printer framework for ESC/POS-compatible thermal printers.
Install / Use
/learn @KevinGong2013/PrinterREADME
ESC/POS Printer Driver for Swift
Description
Swift ticket printer framework for ESC/POS-compatible thermal printers
Requirements
- iOS 12.0+
- Swift 5.3+
Installation
CocoaPods
iOS 12 and newer
Printer is available on CocoaPods. Simply add the following line to your podfile:
# For latest release in cocoapods
pod 'Printer', :git => 'https://github.com/KevinGong2013/Printer.git', :branch => 'refactor'
Getting Started
Import
import Printer
Create ESC/POS Ticket
let receipt = Receipt(.🖨️58(.ascii))
<<~ .style(.initialize)
<<< Image(cgImage)
<<< "Testing"
<<< "Testing"
<<< KV("k", "v")
<<~ .style(.clear)
<<< Image(cgImage, grayThreshold: 28)
<<< Dividing.`default`()
<<~ .page(.printAndFeed(lines: 0))
<<~ .style(.initialize)
<<< QRCode(content: "https://www.apple.com")
<<~ .style(.underlineMode(.enable2dot))
<<~ .page(.printAndFeed(lines: 10))
printer.write(Data(receipt.data))
Write Ticket to Hardware
// connect your pirnter&print ticket.
private let bluetoothPrinterManager = BluetoothPrinterManager()
private let dummyPrinter = DummyPrinter()
if bluetoothPrinterManager.canPrint {
bluetoothPrinterManager.write(ticket)
}
dummyPrinter.write(ticket)
Receipt
[TODO]
Notes
- Send data to your own Bluetooth Manager is possible
Related Skills
node-connect
350.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
109.9kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
350.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
350.1kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
