android.webkit.WebView.createPrintDocumentAdapter()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(2.7k)|赞(0)|评价(0)|浏览(262)

本文整理了Java中android.webkit.WebView.createPrintDocumentAdapter()方法的一些代码示例,展示了WebView.createPrintDocumentAdapter()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebView.createPrintDocumentAdapter()方法的具体详情如下:
包路径:android.webkit.WebView
类名称:WebView
方法名:createPrintDocumentAdapter

WebView.createPrintDocumentAdapter介绍

暂无

代码示例

代码示例来源:origin: commonsguy/cw-omnibus

@Override
 public void onPageFinished(WebView view, String url) {
  print(name, view.createPrintDocumentAdapter(),
     new PrintAttributes.Builder().build());
 }
});

代码示例来源:origin: qiubiteme/android_api_demos

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);
  }
}

代码示例来源:origin: THEONE10211024/ApiDemos

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);
  }
}

代码示例来源:origin: LonamiWebs/Stringlate

/**
 * Print a {@link WebView}'s contents, also allows to create a PDF
 *
 * @param webview WebView
 * @param jobName Name of the job (affects PDF name too)
 * @return {{@link PrintJob}} or null
 */
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
@SuppressWarnings("deprecation")
public PrintJob print(WebView webview, String jobName) {
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
    PrintDocumentAdapter printAdapter;
    PrintManager printManager = (PrintManager) webview.getContext().getSystemService(Context.PRINT_SERVICE);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
      printAdapter = webview.createPrintDocumentAdapter(jobName);
    } else {
      printAdapter = webview.createPrintDocumentAdapter();
    }
    if (printManager != null) {
      return printManager.print(jobName, printAdapter, new PrintAttributes.Builder().build());
    }
  } else {
    Log.e(getClass().getName(), "ERROR: Method called on too low Android API version");
  }
  return null;
}

代码示例来源:origin: andforce/iBeebo

@Override
public boolean onOptionsItemSelected(MenuItem item) {
  Intent intent;
  int itemId = item.getItemId();
  if (itemId == android.R.id.home) {
    intent = new Intent(this, AboutActivity.class);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
    startActivity(intent);
    return true;
  } else if (itemId == R.id.menu_print) {
    PrintManager printManager = (PrintManager) getSystemService(Context.PRINT_SERVICE);
    PrintDocumentAdapter adapter = webView.createPrintDocumentAdapter();
    printManager.print(getString(R.string.app_name), adapter, null);
    return true;
  }
  return false;
}

代码示例来源:origin: THEONE10211024/ApiDemos

mWebView.createPrintDocumentAdapter();

代码示例来源:origin: qiubiteme/android_api_demos

mWebView.createPrintDocumentAdapter();

相关文章

WebView类方法