0

I am trying use jspdf and jspdf-autotable in android webview.

///My print pdf code

const doc = new jsPDF();
autoTable(doc, { html: "#tb1", startY: 75, styles:{font:'Arial',fontSize:9}  });
autoTable(doc, { html: "#tb2", startY: (doc as any).lastAutoTable.finalY +5, styles
               {overflow:'linebreak',font:'Arial',fontSize:9 },  });
doc.save("Invoice.pdf");

// My android webview code

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    web = findViewById(R.id.webView);
    WebSettings webSettings = web.getSettings();
    webSettings.setJavaScriptEnabled(true);
    webSettings.setAllowFileAccess(true);
    webSettings.setDomStorageEnabled(true);
    webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
    web.setWebViewClient(new Callback());
    web.loadUrl(xxx);
}

The jspdf and jspdf-autotable works fine in web but when in android webview I click the download button but there is nothing respond to download the pdf.

Is it possible to use jspdf in android webview to download pdf?

Meow
  • 141
  • 9

0 Answers0