Android Question Print Image same row with multi line text

Keith Yong

Active Member
Licensed User
Longtime User
Hi, I would like to know how can I print the format same like attachment to bluetooth printer. I have search all of the sample given, QR Code (image) can only print under the text. Appreciate if you could let me know the way to achieve this. Thanks
 

Attachments

  • Screen Shot 2019-09-19 at 10.04.40 AM.png
    Screen Shot 2019-09-19 at 10.04.40 AM.png
    15 KB · Views: 164

DonManfred

Expert
Licensed User
Longtime User
how can I print the format same like attachment
i never saw any low cost bluetooth printer able doing this.
Usually you print text or an image. Both are printed in order. one after the other.

You can create a bitmap containing Text and Image as you need it and then print this Bitmap.
 
Upvote 0

Keith Yong

Active Member
Licensed User
Longtime User
I manage to create html code with the format I require. May I know how can I send the html code to the bluetooth print.

I saw there is a library Printing and Pdf creation, but I need to print direct to the printer instead of going thru another step. Is there anyway I can achieve?
 
Upvote 0

Keith Yong

Active Member
Licensed User
Longtime User

Hi Erel,
I already tried these two that you mentioned. It can only print the image in different row.
I have create a html code to display the layout, but I'm not sure how can I send it direct to the bluetooth printer.

B4X:
    Dim htmlData As String=$"<p>&nbsp;</p>
    <table style="height: 89px; width: 230px;">
        <tbody>
            <tr>
                <td style="width: 133.546875px;">
                    <p>ABC</p>
                    <p>ZZZ</p>
                </td>
                <td style="width: 82.453125px;">
                
                <img src="${WebViewAssetFile("cancel.png")}"alt="" width="80" height="80"/></td>
            </tr>
        </tbody>
    </table>
    <p>&nbsp;</p>"$
 
Upvote 0

Keith Yong

Active Member
Licensed User
Longtime User
I'm trying to convert the html to image file, then only print out the image. Not sure whether QR Code still able to scan after that
 
Upvote 0

emexes

Expert
Licensed User
Does Panel have .Snapshop method? If so, put WebBiew fullsize in its own panel, .Snapshot to Image, print image.

But you are possibly right that resolution change due to transfer via screen might affect the quality of the QR code by smudging the edges etc.

But we'll never know 'til you give it a go :)
 
Upvote 0

emexes

Expert
Licensed User
Not sure whether QR Code still able to scan after that
QR codes can have different levels of error correction; if you set it to maximum then your code will be slightly larger (more blocks) but massively more likely to read correctly (compared to minimum level).
 
Upvote 0
Top