Code Monkey home page Code Monkey logo

Comments (13)

followthemoney1 avatar followthemoney1 commented on July 28, 2024 1

Here is my case
code:

  val printer = EscPosPrinter(
        BluetoothPrintersConnections.selectFirstPaired(), 603, 70f, 46,
        EscPosCharsetEncoding("cp866", 17)
    )

    fun printS(sticker: Sticker) {
        val day = sticker.day
        val saleData = sticker.saleDate
        val docNumber = sticker.documentNumber
        val conNameFirst = sticker.contractorName.chunked(sticker.contractorName.length/2)[0]
        val conNameSecond = sticker.contractorName.chunked(sticker.contractorName.length/2)[1]
        val direction = sticker.direction
        val warehouseNum = sticker.warehouseNum
        printer
            .printFormattedText(
                "[C]<font size='medium'>   | $day |$saleData |</font>" +
                        "<font size='wide'>$docNumber</font>\n" +
                        "[L]|\n" +
                        "[C]<font size='medium'>| $conNameFirst |</font>\n" +
                        "[C]<font size='medium'><u>| $conNameSecond |</u></font>\n" +
                        "[L]|\n" +
                        "[C]<font size='medium'><u>| $direction |</u></font>\n" +
                        "[C]<font size='medium'><u>| $warehouseNum |</u></font>",
                122
            )
    }

And here is how it printing
https://streamable.com/zo3sdj

from escpos-thermalprinter-android.

DantSu avatar DantSu commented on July 28, 2024

I think it's 42 characters by line not 46.

Your printer seems to not have a good line heigth for this stickers. Are they compatible ?

from escpos-thermalprinter-android.

followthemoney1 avatar followthemoney1 commented on July 28, 2024

I think it's 42 characters by line not 46.

Also tried, didn't work

Your printer seems to not have a good line heigth for this stickers. Are they compatible ?

Yep, he understands about sticker height and also may skip them 1 by 1, but seems the library doesn't understand how to skip them correctly when printed. So I sow code printer.cutPaper() inside EscPosPrinter but it's don't work also because methods printFormattedText and printFormattedTextAndCut works equals for me. Very strange(

from escpos-thermalprinter-android.

DantSu avatar DantSu commented on July 28, 2024

Ok I have may be a solution. I will send you tomorrow.

from escpos-thermalprinter-android.

followthemoney1 avatar followthemoney1 commented on July 28, 2024

@DantSu That would be very cool, I would be very grateful. I can shoot a video of how it works now if you run it, if it helps

from escpos-thermalprinter-android.

DantSu avatar DantSu commented on July 28, 2024

please use the last version v2.0.5.

printFormattedText(String text, int dotsFeedPaper)
dotsFeedPaper will allow you to feed paper with dot precision (depending of your printer dpi). Accepted value 0 to 255.

from escpos-thermalprinter-android.

followthemoney1 avatar followthemoney1 commented on July 28, 2024

@DantSu Thank you very much, I did not expect it to work at all !! How can I thank you?) You are using the "buy me a coffee" service?

from escpos-thermalprinter-android.

DantSu avatar DantSu commented on July 28, 2024

Do you have a picture of the final printing ?

You already star the repo, it's enought ;)

from escpos-thermalprinter-android.

followthemoney1 avatar followthemoney1 commented on July 28, 2024

@DantSu I would like to support the project in some other way. Yes here is the picture
image

from escpos-thermalprinter-android.

DantSu avatar DantSu commented on July 28, 2024

Ho yeah ! Great ! That solve the problem.
To support the project : Test the library, report bugs, create PR.
I just wan't to do the most universal Android library for ESC/POS printer. For now, it's not perfect but each issue and PR help me to be closest. ;)

from escpos-thermalprinter-android.

followthemoney1 avatar followthemoney1 commented on July 28, 2024

@DantSu Ok, then I'll send you end version with screenshot and code, maybe it's helping someone )))

from escpos-thermalprinter-android.

DantSu avatar DantSu commented on July 28, 2024

Yes, that will be perfect :)

from escpos-thermalprinter-android.

DantSu avatar DantSu commented on July 28, 2024

Nice ! thx for sharing

from escpos-thermalprinter-android.

Related Issues (20)

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.