.. _object_UsbPrinter: :index:`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 :ref:`IoDevice.write() ` method. This object was introduced in InCore 2.3. :**› Inherits**: :ref:`File ` Overview ******** Properties ++++++++++ .. hlist:: :columns: 3 * :ref:`index ` * :ref:`File.error ` * :ref:`File.errorString ` * :ref:`File.fileName ` * :ref:`File.storage ` * :ref:`IoDevice.append ` * :ref:`IoDevice.atEnd ` * :ref:`IoDevice.autoOpen ` * :ref:`IoDevice.bytesAvailable ` * :ref:`IoDevice.canReadLine ` * :ref:`IoDevice.deviceErrorString ` * :ref:`IoDevice.isOpen ` * :ref:`IoDevice.isWritable ` * :ref:`IoDevice.nameArgument ` * :ref:`IoDevice.pos ` * :ref:`IoDevice.readOnly ` * :ref:`IoDevice.size ` * :ref:`IoDevice.truncate ` * :ref:`IoDevice.unbuffered ` * :ref:`Object.objectId ` * :ref:`Object.parent ` Methods +++++++ .. hlist:: :columns: 3 * :ref:`File.remove() ` * :ref:`File.sync() ` * :ref:`IoDevice.close() ` * :ref:`IoDevice.flush() ` * :ref:`IoDevice.open() ` * :ref:`IoDevice.peekAll() ` * :ref:`IoDevice.read() ` * :ref:`IoDevice.readAll() ` * :ref:`IoDevice.readLine() ` * :ref:`IoDevice.sync() ` * :ref:`IoDevice.write() ` * :ref:`Object.deserializeProperties() ` * :ref:`Object.fromJson() ` * :ref:`Object.serializeProperties() ` * :ref:`Object.toJson() ` Signals +++++++ .. hlist:: :columns: 1 * :ref:`File.errorOccurred() ` * :ref:`IoDevice.lineAvailableForRead() ` * :ref:`IoDevice.readyRead() ` * :ref:`Object.completed() ` Enumerations ++++++++++++ .. hlist:: :columns: 1 * :ref:`File.Error ` Properties ********** .. _property_UsbPrinter_index: .. _signal_UsbPrinter_indexChanged: .. index:: single: index index +++++ This property holds the index of the printer which to communicate with. :**› Type**: SignedInteger :**› Default**: ``0`` :**› Signal**: indexChanged() :**› Attributes**: Writable .. _example_UsbPrinter: Example ******* .. code-block:: qml 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(); } }