question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Text position change

See original GitHub issue

Hey, as you can see from image, It always changes text position. What problem may it be? And also change dpi isn’t change anything… image

Just simple code

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

    fun printS() {
        printer
            .printFormattedText(
                "[C]    <b>1</b>[R]24.99e\n" +
                        "[C]  <b>2</b>2\n" +
                        "[C]     <b>3</b>\n" +
                        "[C]         <b>4</b>[R]24.99e\n" +
                        "[C]        <b>5</b>\n" +
                        "[C]        <b>6</b>"
            )
    }

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
followthemoney1commented, Jul 22, 2020

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

0reactions
DantSucommented, Jul 22, 2020

Nice ! thx for sharing

Read more comments on GitHub >

github_iconTop Results From Across the Web

CSS Text Alignment and Text Direction - W3Schools
The text-align property is used to set the horizontal alignment of a text. A text can be left or right aligned, centered, or...
Read more >
Align text or adjust the margins within a text box
Align text horizontally · In the text box, select the text that you want to change the horizontal alignment for. · On the...
Read more >
How to change the text position - Stack Overflow
To change the position of the text after, you need to create a style of the text in CSS, obviously. To do this,...
Read more >
CSS - Positioning - Tutorialspoint
Relative positioning changes the position of the HTML element relative to where it normally appears. So "left:20" adds 20 pixels to the element's...
Read more >
How to Align Text in HTML? - GeeksforGeeks
We can change the alignment of the text using the text-align property. We can align the text in the center, Left, Right.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found