How to print a webview to a bluetooth printer?

Asked

Viewed 858 times

0

I’m making an application that needs to print the contents of a webview , but the printer is bluetooth , could help me?

1 answer

1


Printing in bluetooth on android is not a simple thing, nor so little easy to be done.

I’ll leave here a path so you can achieve your goal:

  1. There is a library that makes communication with Bluetooh directly already. But for curiosity, you have to list the bluetooth devices and after finding them, you have to open a socket for them and send the print. This library makes all this work easier.

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

  3. After taking a snapshot of your webview, you send it to the library in 1, calling the printImage(Bitmap method).

Browser other questions tagged

You are not signed in. Login or sign up in order to post.