コード例 #1
0
  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());
  }
コード例 #2
0
 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);
 }