O
O
Oleg2021-02-03 00:46:37
Android
Oleg, 2021-02-03 00:46:37

How to overcome Chinese AndroidBOX to get PrintDocumentAdapter working?

There is a cheap TVBOX with Android 10.
The principle is out of focus app = unloaded from memory. elevated to absolute on it.

//create object of print manager in your device
 PrintManager printManager = (PrintManager) Objects.requireNonNull(getContext()).getSystemService(Context.PRINT_SERVICE);

//create object of print adapter
 PrintDocumentAdapter printAdapter = webView.createPrintDocumentAdapter();

//provide name to your newly generated pdf file
String jobName = "Html2Print";

 //open print dialog
 if (printManager != null) {
   printManager.print(jobName, printAdapter, new PrintAttributes.Builder().setMinMargins(new PrintAttributes.Margins(250, 250, 250, 250)).build());
}


The activity loses focus. application to debuild. The print service is crashing because it's going to fetch data to a location that doesn't already exist.

Really overcome?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question