I am trying to make simple application to test printing a WebView page.
Below is my simple code
WebView webView = new WebView(this);
webView.LoadUrl("https://www.google.com");
PrintDocumentAdapter adapter = webView.CreatePrintDocumentAdapter("test");
PrintManager printMgr = (PrintManager)GetSystemService(PrintService);
printMgr.Print("printTest", adapter, null);
myWebView = webView;
However, it is generating an exception in WebView.CreatePrintDocumentAdapter("test")
method, which is written below.
Java.Lang.NoSuchMethodError: no method with name='createPrintDocumentAdapter' signature='(Ljava/lang/String;)Landroid/print/PrintDocumentAdapter;' in class Landroid/webkit/WebView;
Note that I have included internet and network state permission in Android manifest. What is causing this? How could I create print feature if this exception blocks it?
The device that I am using is Samsung SM-G7102 (Android 4.4 - API 19)
Any helps would be appreciated.