Code Monkey home page Code Monkey logo

thermal-printer-in-android's Introduction

Thermal-Printer-in-Android

Thermal Bluetooth Printer connection with Android which print Text, Title and Image .

My test device was Cashino PTP-II Printer. Demo Application with Source Code.

  • Print Text
  • Print Title
  • Print Unicode
  • Print Icon

Preview: https://youtu.be/emedLinWHR4

Buy Cashino PTP-II from Amazon: https://amzn.to/388pxQ3

ESC/POS Bluetooth Print project is availabe on play store, test live example:
https://play.google.com/store/apps/details?id=infixsoft.imrankst1221.printer
InfixSoft

If you like, give it a ★ at the top right of this page.

Hi, Imran and I am mobile app designer & developer. I love coffee and travel to new places.

  • Hire me to help you make cool stuff. Note: If you're having a problem with this library, please open an issue
  • If you found something new which helps others please contribute in this library.
  • Check out my website to see some of my other projects.
  • Building and maintaining this free library takes a lot of my time and saves you time. Please consider paying it forward by supporting me with a small amount to my PayPal.

Contact with me

InfixSoft Add me to Linkedin Facebook Facebook Facebook
  • Buy me a Coffee. ☕️

thermal-printer-in-android's People

Contributors

imrankst1221 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

thermal-printer-in-android's Issues

Issue is Bluetooth print

After installing APK file in my mobile, it is turning on bluetooth, but not showing available devices. It is just showing the white screen without any data

Align Image in center

Hi I am working on printing receipt.
But i am stuck in printing image in the center of the reciept. i am using 80mm paper and black copper printer. when i am aligning the text using the public static byte[] ESC_Align = new byte[] {0x1b, 0x61, 0x01 } command it center the text perfectly with no issue, but when i try to center the image and the barcode it doesn't center it.
Can you please guide me how to solve this issue?
It will be your kind pleasure.

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

Hello Imran,

Thanks for your your solution. Please do let me know what is the issue

02-20 14:22:43.443 29100-29229/infixsoft.imrankst1221.printer W/BluetoothAdapter: getBluetoothService() called with no BluetoothManagerCallback
02-20 14:22:43.686 29100-29229/infixsoft.imrankst1221.printer W/System.err: java.io.IOException: read failed, socket might closed or timeout, read ret: -1
at android.bluetooth.BluetoothSocket.readAll(BluetoothSocket.java:740)
at android.bluetooth.BluetoothSocket.readInt(BluetoothSocket.java:752)
at android.bluetooth.BluetoothSocket.connect(BluetoothSocket.java:374)
at infixsoft.imrankst1221.printer.DeviceList$2.run(DeviceList.java:245)
02-20 14:22:43.687 29100-29229/infixsoft.imrankst1221.printer W/System.err: at java.lang.Thread.run(Thread.java:818)

Please do let me the solution.
Thanks
Amit

DeviceList is empty

The App was working fine, but I think that after a update of android when I try to print, in the DeviceList activity the screen stay in blank.
I was debugging, and I found what the mBTReceiver never is called, I'm trying to fix this bug but I'm sure that you solve faster.

Mi Android version: 9 PKQ1.180904.001
Xiaomi version(MIUI): 11.0.3.0 (PEIMIXM)

but I test in anothers phones with the same problem.

Printer Hindi language does not supported. - Thermal-Printer-in-Android

How to write pragmatically support Hindi language in Thermal-Printer-in-Android printer. have any idea ? Please let me know.

mPrinter.printText("नमस्कार नमस्कार नमस्कार नमस्कार नमस्कार नमस्कार ");

I try this but it not working .

Question to decodeBitmap

hi

thanks for sharing your code, I have a question to this line code in your decodeBitmap function.

String commandHexString = "1D763000";

1D is so far clear for me, I guess :-) , but what are doing the others?

Best fishme

multiple printers

Can i connect more than 1 printer ?

I have one printer in for invoice e other for the food.. can i have two instances? @imrankst1221 can u help me?

Ask

i Want to costume this app for print bill.
Where for read documentation code for Thermal??

Pdf support

How can i print pdf file?
Can you please add the pdf print support?

Print image via bluetooth printer

Hello @imrankst1221

if i set height up to 255 in CreateBitmap method.
Bitmap bmpGrayscale = Bitmap.CreateBitmap(OriginalBitmap.Width, 257, Bitmap.Config.Argb8888);

then DecodeBitmap method return null

byte[] command = Utils.DecodeBitmap(bmpGrayscale);

Please guide me

External app communication

Hi. I'm trying to use the app to print from web to the android app, but I haven't able to do that, because when I make the call it's opening the app store. And I need to print the text I send it.

window.location.href = "intent://" + textEncoded + "#Intent;package=infixsoft.imrankst1221.printer;end;";

"Cannot establish connection"

i get the list of my bluetooth printer, when i click to it, it says "cannot establish connection", is there anything im missing?

Max Width and Height

Hello @imrankst1221 , how can I modify the max width and height for image printing, in Utils.decodeBitmap?

if (widthHexString.length() > 2) {
Log.e("decodeBitmap error", " width is too large");
return null;

if (heightHexString.length() > 2) {
Log.e("decodeBitmap error", " height is too large");
return null;

Unable to get UUID

UUID uuid = btDevices.getItem(position).getUuids()[0] .getUuid();

getUuids() returns null.

Line number 215 (DeviceList.java)

How to align image to center?

I tried to print QrCode and alignt it to center, didn´t workout, ou have any example on how to align images to center?

Printing QR Code as Image

Hello,

I am trying to print QR Code as image. Passed base64 string for a print. Its printing QR Code but only 10% of it. Also, could you please elaborate what exactly String commandHexString = "1D763000"; is for.

untitled

Multiple connection

How can multiple connections be made? can you change your project for this?
Thanks

large text

Please help me

i want to large text more
byte[] bb3 = new byte[]{0x1B,0x21,0x10}; // 3- bold with large text

Problem With arabic text

I tried to print arabic text but i failed?
any idea please?

printText("بسم الله الرحمن الرحيم");

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.