How to print a webview on a bluetooth printer?

0

I am making an application that it needs to print the contents of a webview, however the printer is bluetooth, could they help me?

    
asked by anonymous 14.12.2017 / 20:44

1 answer

1

Printing on bluetooth on android is not a simple thing, nor is it so easy to do.

I'll leave here a way to reach your goal:

  • There is a library that communicates with bluetooh directly already. But for curiosity, you have to list bluetooth devices and after finding them, you have to open a socket for it and send the impression. This library makes all that work easier.

  • As a web page is rendered already, and as the interest is to print it formatted, not the source code, you would have to generate an image of this html. If used. This answer from SOen will show you how to do this.

  • Once you have a snapshot of your webview, you send it to the library at 1, calling the printImage (Bitmap) method.

  • 15.12.2017 / 12:14