Print Report From Application using WiFi Printer.

edited June 2019 in Projects

Below Code causing PrintSpooler Crash and Not Printing at All.

private void createWebPrintJob(WebView webView) {

    // Get a PrintManager instance
    PrintManager printManager = null;
        printManager = (PrintManager) getBaseContext()

    String jobName = getString(R.string.app_name) + " Document";

    // Get a print adapter instance
    PrintDocumentAdapter printAdapter = null;
        printAdapter = webView.createPrintDocumentAdapter(jobName);

    // Create a print job with name and adapter instance
    PrintJob printJob = null;
        printJob = printManager.print(jobName, printAdapter,
                new PrintAttributes.Builder().build());
    // Save the job object for later status checking

private WebView mWebView;

private void doWebViewPrint() {
    // Create a WebView object specifically for printing
    WebView webView = new WebView(getApplicationContext());
    webView.setWebViewClient(new WebViewClient() {

        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            return false;

        public void onPageFinished(WebView view, String url) {
            mWebView = null;

    // Generate an HTML document on the fly:
    String htmlDocument = "<html><body><h1>Test Content</h1><p>Testing, " +
            "testing, testing...</p></body></html>";
    webView.loadDataWithBaseURL(null, HtmlEmail, "text/HTML", "UTF-8", null);

    // Keep a reference to WebView object until you pass the PrintDocumentAdapter
    // to the PrintManager
    mWebView = webView;


  • After some debugging, it looks like Android can't find one resource. However, this resource is included into the build, so I am quite confused right now. Could you create a full demo application (as APK file) for our tests?

  • Hi,
    Please download APK From below Link and After Splash Screen click on Start andAbove code will execute and get crashed.
    Please test and provide the solution to me.

  • Hi when can i get solution for above Issue.

  • @kalkov said:
    After some debugging, it looks like Android can't find one resource. However, this resource is included into the build, so I am quite confused right now. Could you create a full demo application (as APK file) for our tests?

    HI Please download APK from given link and please provide solution

  • I got your file, thank you. The problem seems to be caused by some low-level components, so it will take some time for us to fix it. I can't provide any OTA for now.

  • when can i expect solution for this problem?

  • Have You tried this APK.
    That APK Works with Any Android Phone also able to print using wifi but not With Emteria OS. when can i expect this solution?

  • is there any update on WiFi Printing currently print spooler getting crashed again and again

  • Sorry, we currently have no free resources to take care of this. As I said before, I can't provide any OTA.

  • @Vinayak, your link is expired, we cannot download your sample application for testing.

  • Since we cannot download your file, we took the standard ApiDemo application (e.g. and tested how printing works with it. To our surprise, it worked just fine - we could print a page off the built-in webview without any crashes.

  • edited June 2019
    2019-06-20 12:36:38.141 28657-28657/? E/AndroidRuntime: FATAL EXCEPTION: main
    Process:, PID: 28657
    android.view.InflateException: Binary XML file line #113: Binary XML file line #273: Error inflating class android.widget.ImageView
    2019-06-20 12:36:38.387 474-510/system_process E/InputDispatcher: channel '6e0b8cc (server)' ~ Channel is unrecoverably broken and will be disposed!
    2019-06-20 12:36:44.124 28624-28643/? E/bt_hci: startup_timer_expired
    2019-06-20 12:36:44.124 28624-28640/? E/bt_core_module: module_start_up Failed to start up module "hci_module"
  • Yes, I saw your report. But since the official example is working, you must debug your application.
  • dear I have tested this api demo apk and its not working and getting crashed.
    same crashes same errors so as per your saying" since the official example is working, you must debug your application." i would like to know on which Emteria Version you have tested .
    I have installed latest 0.7.1 but still it shows RPi3 v0.6.4 in Settings Emteria Version.
    Please provide proper solution for WiFi Priting .I ll share you screenshot of AndroidApiDemo Official Getting Crashed.
  • Sure, here is a full video of the print application working:
    It is the application from the GitHub project I referenced above

  • is not working also tell me on which emteria version you tested the application.

  • What do you mean it is not working? You can see in the video it is the OS version 0.7.1 and the printing application does not crash.

  • i mean link is not working its showing This site can’t be reached The webpage at might be temporarily down or it may have moved permanently to a new web address.

  • can you share video using wetransfer or anyother medium

  • 1st Above video works only when we keep Display size as Default (Small Not Working ).
    Then I made it as default it shows save as pdf which works fine but when i select add printer it shows Add printer->Recommendded Service Samsung Install to Discover but when i click on it It says no such app found.
    Please tell me what needs to be done to invoke wifi printer dynamically.

  • Sorry, I don't understand. Please explain in full detail.

  • Is this the same code applicable for the WiFi connected printer HP Designjet T520? If yes please reply then I will install this software on my PC.

  • use wi fi printer to get better connectivity. to connect your wi fi printer with your router you have to use some android application. see linksys e1200 setup to set your router error free with your wi fi printer. different software guide you very different installation process of wi fi.

Sign In or Register to comment.