UsbPrinter¶
Description¶
The UsbPrinter object allows controlling a printer connected to a local USB port. When opened, data such as PostScript or ZPL can be sent to the printer using the IoDevice.write() method.
This object was introduced in InCore 2.3.
› Inherits: | File |
---|
Properties¶
index¶
This property holds the index of the printer which to communicate with.
› Type: | SignedInteger |
---|---|
› Default: | 0 |
› Signal: | indexChanged() |
› Attributes: | Writable |
Example¶
import InCore.IO 2.5
UsbPrinter {
index: 0
autoOpen: true
onIsOpenChanged: {
console.log("printing")
// print QR code on ZPL-based label printer
write("^XA
^FO20,20^BQ,2,10^FDQA,0123456789ABCD 2D code^FS
^XZ")
flush();
}
}