Thing No 1: can i get some help with ViewPrintJob.Builder ?
I've created the linear layout containing a bunch of textviews and few linear layouts, sent the main container view it to the ViewPrintJob.Builder, but it doesnt print anything...
I cant find any tiny snippet of this method on the docs.
Can someone give an example of this?

Thing No 2: i was thinking if its possible to get the bitmap of a webview and send it to the printer or maybe get the bitmap of an image and send it to the printer, using ImagePrintJob for both cases... So is it possible?

asked 2017-05-09 12:13:07 -0500

Tacs gravatar image

First thing is to, using your own code, render your layout as a Bitmap. Encode the Bitmap as a PNG, and ensure it looks as you expect. This is going to tell if you the problem is w/ your layout, or with the printer.

jeff gravatar image
jeff 2017-05-09 13:32:12 -0500

HI @jeff !
I created a dialog with an imageview and i set the bitmap on that imageview and its the bitmap i want...
Right after the dialog.show, i send the bitmap to the "ImagePrintjob.Builder().bitmap(bitmapy).build()" and i get a null exception.. I have a TextPrintjob before and works...
By the way, when using TextPrintJob is there anyway to know the when the line ends or its width or char limits? How am i suppose to know if i add line and its bigger than the actual line?

Tacs gravatar image
Tacs 2017-05-10 10:27:07 -0500

Show your code, and the exception, and the logcat around the exception.

jeff gravatar image
jeff 2017-05-10 10:49:48 -0500

re: TextPrintJob. No, it's very limited. You'd just need to experiment to find something that looks okay for your pruposes.

jeff gravatar image
jeff 2017-05-10 10:50:47 -0500