1. Are you ready for the Galaxy S20? Here is everything we know so far!

Print receipt as image on thermal printer

Discussion in 'Android Lounge' started by ronnie025, Jun 23, 2022.

  1. ronnie025

    ronnie025 Lurker
    Thread Starter

    Trying to print receipt in native languages by converting to bitmap image and passing to open source printer sdk.
     



    1. Download the Forums for Android™ app!


      Download

       
  2. ocnbrze

    ocnbrze DON'T PANIC!!!!!!!!!

    huh? can you be more specific? are you developing an app? what phone do you have? what is the exact problem? its hard to help if you don't have a specific question in mind.

    just remember, the more details you give us the better we can help.
     
    Dannydet likes this.
  3. ronnie025

    ronnie025 Lurker
    Thread Starter


    Sorry for the late reply.
    Answer to your question:

    I'm given the task of developing a feature for an Android app which is to print text in receipt format (sales invoice, quotation etc.) in native languages.

    Since most general printers doesn't support character sets for native languages like South Asian languages such as Indian languages, which is my requirement. The hack is to convert the native language text to an image and send it to the printer SDK.

    I've tried creating a bitmap by drawing the text on a canvas object and passing the bitmap to the printer SDK but the tedious task is to create the entire receipt format by drawing on the canvas providing the x and y coordinates.

    The next solution I tried is to inflate an XML layout according to the receipt format and set the data to the corresponding views, convert the root view to a bitmap and pass it to the printer SDK. This solution is working, but my problem is I'm trying to integrate this solution without creating an extra layout or activity in the app.

    Any suggestions would be appreciated. Thanks.

    The app uses the following SDK for printing text in English from the app (working feature)

    https://github.com/DantSu/ESCPOS-ThermalPrinter-Android
     
Loading...

Share This Page

Loading...