private void createWebPrintJob(WebView webView) { PrintManager printManager = (PrintManager) this.getSystemService(Context.PRINT_SERVICE); PrintDocumentAdapter printAdapter = webView.createPrintDocumentAdapter("MyDocument"); String jobName = getString(R.string.app_name) + " Print Test"; printManager.print(jobName, printAdapter, new PrintAttributes.Builder().build()); }
private void print() { // Get the print manager. PrintManager printManager = (PrintManager) getSystemService(Context.PRINT_SERVICE); // Pass in the ViewView's document adapter. printManager.print("MotoGP stats", mWebView.createPrintDocumentAdapter(), null); }