Giter Club home page Giter Club logo

printama's Issues

System.err: java.io.IOException: Broken pipe

My old application is dependent on this library, but since some time it showing error and worked now , The bluetooth printer is connected fine but not print the receipt, the every function of printer util like printtext, printline etc. I cloned the printama android demo project and showing same error. so Please resolve this issue.

Here is the Android logs:-

2023-06-05 19:00:30.583 18376-18376/com.anggastudio.sample W/System.err: java.io.IOException: Broken pipe
2023-06-05 19:00:30.584 18376-18376/com.anggastudio.sample W/System.err: at android.net.LocalSocketImpl.writeba_native(Native Method)
2023-06-05 19:00:30.584 18376-18376/com.anggastudio.sample W/System.err: at android.net.LocalSocketImpl.access$500(LocalSocketImpl.java:37)
2023-06-05 19:00:30.584 18376-18376/com.anggastudio.sample W/System.err: at android.net.LocalSocketImpl$SocketOutputStream.write(LocalSocketImpl.java:144)
2023-06-05 19:00:30.584 18376-18376/com.anggastudio.sample W/System.err: at android.bluetooth.BluetoothSocket.write(BluetoothSocket.java:786)
2023-06-05 19:00:30.584 18376-18376/com.anggastudio.sample W/System.err: at android.bluetooth.BluetoothOutputStream.write(BluetoothOutputStream.java:79)
2023-06-05 19:00:30.584 18376-18376/com.anggastudio.sample W/System.err: at java.io.OutputStream.write(OutputStream.java:122)
2023-06-05 19:00:30.584 18376-18376/com.anggastudio.sample W/System.err: at com.anggastudio.printama.PrinterUtil.printUnicode(PrinterUtil.java:94)
2023-06-05 19:00:30.585 18376-18376/com.anggastudio.sample W/System.err: at com.anggastudio.printama.PrinterUtil.addNewLine(PrinterUtil.java:166)
2023-06-05 19:00:30.585 18376-18376/com.anggastudio.sample W/System.err: at com.anggastudio.printama.PrinterUtil.feedPaper(PrinterUtil.java:290)
2023-06-05 19:00:30.585 18376-18376/com.anggastudio.sample W/System.err: at com.anggastudio.printama.Printama.feedPaper(Printama.java:184)
2023-06-05 19:00:30.585 18376-18376/com.anggastudio.sample W/System.err: at com.anggastudio.printama.Printama.lambda$printTest$2(Printama.java:127)
2023-06-05 19:00:30.585 18376-18376/com.anggastudio.sample W/System.err: at com.anggastudio.printama.-$$Lambda$Printama$RmuijsPIw_E46bsFguHyZkOvvNI.onConnected(Unknown Source:0)
2023-06-05 19:00:30.585 18376-18376/com.anggastudio.sample W/System.err: at com.anggastudio.printama.Printama.lambda$connect$0$Printama(Printama.java:102)
2023-06-05 19:00:30.585 18376-18376/com.anggastudio.sample W/System.err: at com.anggastudio.printama.-$$Lambda$Printama$8huuBLTLR2MZ4RxuJjF9x13epEw.onConnected(Unknown Source:4)
2023-06-05 19:00:30.585 18376-18376/com.anggastudio.sample W/System.err: at com.anggastudio.printama.PrinterUtil$1.onConnected(PrinterUtil.java:63)
2023-06-05 19:00:30.585 18376-18376/com.anggastudio.sample W/System.err: at com.anggastudio.printama.PrinterUtil$ConnectAsyncTask.onPostExecute(PrinterUtil.java:327)
2023-06-05 19:00:30.585 18376-18376/com.anggastudio.sample W/System.err: at com.anggastudio.printama.PrinterUtil$ConnectAsyncTask.onPostExecute(PrinterUtil.java:294)
2023-06-05 19:00:30.585 18376-18376/com.anggastudio.sample W/System.err: at android.os.AsyncTask.finish(AsyncTask.java:771)
2023-06-05 19:00:30.586 18376-18376/com.anggastudio.sample W/System.err: at android.os.AsyncTask.access$900(AsyncTask.java:199)
2023-06-05 19:00:30.586 18376-18376/com.anggastudio.sample W/System.err: at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:788)
2023-06-05 19:00:30.586 18376-18376/com.anggastudio.sample W/System.err: at android.os.Handler.dispatchMessage(Handler.java:106)
2023-06-05 19:00:30.586 18376-18376/com.anggastudio.sample W/System.err: at android.os.Looper.loopOnce(Looper.java:226)
2023-06-05 19:00:30.586 18376-18376/com.anggastudio.sample W/System.err: at android.os.Looper.loop(Looper.java:313)
2023-06-05 19:00:30.586 18376-18376/com.anggastudio.sample W/System.err: at android.app.ActivityThread.main(ActivityThread.java:8751)
2023-06-05 19:00:30.586 18376-18376/com.anggastudio.sample W/System.err: at java.lang.reflect.Method.invoke(Native Method)
2023-06-05 19:00:30.586 18376-18376/com.anggastudio.sample W/System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
2023-06-05 19:00:30.586 18376-18376/com.anggastudio.sample W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)

Screenshot_3

Error when changed android sdk to 32

Please help me! when i changed to android studio debugger says : * What went wrong:
Execution failed for task ':printama:compileDebugJavaWithJavac'.

Compilation failed; see the compiler error output for details.

How can I set bitmap/image width as printer's paper width?

Hi, I just mailed you about this issue.

You set PRINTER_WIDTH = 384 (which is fixed). That doesn't care about the actual printer paper width. Instead of that, can't we detect printer paper size from socket data? or you can add a paper size option on choose printer dialog. So, if we set 58mm/80mm/custom width, then it will be used as printer width throughout the app for that selected printer.

Cannot print on Embedded printer

I am testing this library on JP-Q2i POS Terminal PDA (Embedded printer is configured as Bluetooth device)
but I cannot print a text.

Printama.with(this).connect(new Printama.OnConnected() {
                    @Override
                    public void onConnected(Printama printama) {
                        printama.printText("TEST");
                    }
                });

Library connect with MPT-II but not start a print

Printed Images Changing into Unreadable Character

How its happened

Before this happened, I tried to print an image (logo) with several text below it, and its works verry well with no issue, but after I added QR Code (Bitmap) to be printed with, the logo just printed half and half more becomes unreadable character (image below)

Here it is the code that i used for :

val logo = Printama.getBitmapFromVector(activity, R.drawable.logo_black)
val nota = "Some Text"
Printama.with(activity).connect({ printama: Printama ->
      printama.printImage(logo, 200)
      printama.addNewLine()
      printama.printTextln(Printama.CENTER, "Title Text")
      printama.setNormalText()
      printama.printTextln(
          Printama.CENTER,
          "Some Text"
      )
    printama.printDashedLine()

    val writer = QRCodeWriter()
    val bitMatrix = writer.encode(nota, BarcodeFormat.QR_CODE, 300, 300)
    val width = bitMatrix.width
    val height = bitMatrix.height
    val bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.RGB_565)
    for (x in 0 until width) {
        for (y in 0 until height) {
            bitmap.setPixel(x, y, if (bitMatrix.get(x, y)) Color.BLACK else Color.WHITE)
        }
    }

    bitmap?.let {
        printama.printImage(it)
    }

    printama.addNewLine()
    printama.feedPaper()
    printama.close()
}) { message: String? -> activity.toast(message) }

WhatsApp Image 2021-04-25 at 15 47 42

DPI and Font Style

Hi, I'm just wondering how to Set the DPI and Font Style

I download a apk "RawBT" it can change the font to True Type Font and DPI to 304

Build error after adding the gradles

Task failed with an exception.

  • What went wrong:
    Execution failed for task ':app:mergeDebugNativeLibs'.

Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Could not find com.github.anggastudio:Printama:0.9.7.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/github/anggastudio/Printama/0.9.7/Printama-0.9.7.pom
- https://repo.maven.apache.org/maven2/com/github/anggastudio/Printama/0.9.7/Printama-0.9.7.pom
- https://jcenter.bintray.com/com/github/anggastudio/Printama/0.9.7/Printama-0.9.7.pom
Required by:
project :app

2 printer device?

can i connect more than one print?
Just create another instance of printama?

Someone can help me?

W/System.err: java.io.IOException: read failed, socket might closed or timeout, read ret: -1

@derohimat @isfaaghyth @utsmannn @anggastudio
W/System.err: java.io.IOException: read failed, socket might closed or timeout, read ret: -1

BluetoothDevice device = bluetoothDevices[0];
            UUID uuid;
            if (device != null) {
                ParcelUuid[] uuids = device.getUuids();
                uuid = (uuids != null && uuids.length > 0) ? uuids[0].getUuid() : UUID.randomUUID();
            } else {
                return null;
            }
            BluetoothSocket socket = null;
            boolean connected = true;
            try {
                socket = device.createRfcommSocketToServiceRecord(uuid);
                socket.connect();
            } catch (IOException e) {
                e.printStackTrace();
            } catch (Exception e2) {
                connected = false;
            }
            return connected ? socket : null;

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.