Remove android auto print margin (Closes #81)

This commit is contained in:
Sebastián Katzer 2016-07-24 09:53:51 +02:00
parent ea404a0acd
commit 147f562d0a

View File

@ -28,6 +28,8 @@ import android.print.PrintAttributes;
import android.print.PrintDocumentAdapter; import android.print.PrintDocumentAdapter;
import android.print.PrintJob; import android.print.PrintJob;
import android.print.PrintManager; import android.print.PrintManager;
import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebView; import android.webkit.WebView;
import android.webkit.WebViewClient; import android.webkit.WebViewClient;
@ -156,10 +158,22 @@ public class Printer extends CordovaPlugin {
* The JSON object with the containing page properties * The JSON object with the containing page properties
*/ */
private void initWebView (JSONObject props) { private void initWebView (JSONObject props) {
Activity ctx = cordova.getActivity(); Activity ctx = cordova.getActivity();
view = new WebView(ctx); view = new WebView(ctx);
WebSettings settings = view.getSettings();
view.getSettings().setDatabaseEnabled(true); settings.setDatabaseEnabled(true);
settings.setGeolocationEnabled(true);
settings.setSaveFormData(true);
settings.setUseWideViewPort(true);
view.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
if (Build.VERSION.SDK_INT >= 21) {
Method setMixedContentModeMethod = getMethod(settings.getClass(),
"setMixedContentMode", int.class);
invokeMethod(settings, setMixedContentModeMethod, 2);
}
setWebViewClient(props); setWebViewClient(props);
} }