Home » Android » Print to dot matrix printex from android/java-Exceptionshub

Print to dot matrix printex from android/java-Exceptionshub

Posted by: admin February 24, 2020 Leave a comment

Questions:

I want to print a pdf / html file that I will convert to bitmap using ip connection and socket, how can I do this on an epson lx-350 matrix printer? does it support esc/p
there are examples on the Internet only for esc/pos , in my case they do not work, I manage to print only a simple ASCII simbols ,i want to find solution for android platform.

try {
        Socket(ip, port).use { socket ->`enter code here`
            val outStream = socket.getOutputStream()
            val fpath = "/sdcard/" + "pdfToHtml.pdf"
            val fl = File(fpath)
            val bmp = BitmapFactory.decodeResource(
                resources,
                R.drawable.img
            )
            if (bmp != null) {
                val command: ByteArray = PrintUtility.decodeBitmap(bmp)
                outStream.write(command)
                outStream.write(PrinterCommands.FEED_LINE)
            } else {
                Log.e("Print Photo error", "the file isn't exists")
            }
            emitter.onSuccess("Success printing")

Regards Almas

How to&Answers: