0

I need to print a image using thermal printer. Now I am able to print text using below code,

private fun printBill() {
        Thread {
            try {
                val sock = Socket("192.168.100.99", 9100)
                val oStream = PrintWriter(sock.getOutputStream())
                oStream.printf("%-35s %-5s %5s\n", "Jihin Raju", 10.00, 100.00)
                oStream.println(charArrayOf(0x1D.toChar(), 0x56.toChar(), 0x41.toChar(), 0x10.toChar()))
                oStream.close()
                sock.close()
            } catch (e: UnknownHostException) {
                e.printStackTrace()
            } catch (e: IOException) {
                e.printStackTrace()
            }
            runOnUiThread {
                Toast.makeText(this@MainActivity, "Printed ", Toast.LENGTH_SHORT).show()
            }
        }.start()
    }

Is there any way to print image

Sagar Zala
  • 4,854
  • 9
  • 34
  • 62
byteC0de
  • 5,153
  • 5
  • 33
  • 66

0 Answers0