From 0dac03a1686cecbff4b939d8de861452b6d7498a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Katzer?= Date: Wed, 30 Jan 2019 14:51:09 +0100 Subject: [PATCH] Support to set the font size for plain text on Android --- src/android/PrintManager.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/android/PrintManager.java b/src/android/PrintManager.java index 6f494b7..1ce5bc5 100644 --- a/src/android/PrintManager.java +++ b/src/android/PrintManager.java @@ -261,6 +261,7 @@ class PrintManager { boolean jsEnabled = settings.optBoolean("javascript", false); WebView view = new WebView(context); WebSettings spec = view.getSettings(); + JSONObject style = settings.optJSONObject("style"); spec.setDatabaseEnabled(true); spec.setGeolocationEnabled(true); @@ -268,7 +269,13 @@ class PrintManager { spec.setUseWideViewPort(true); spec.setJavaScriptEnabled(jsEnabled); - if (SDK_INT >= 21) { + if (style != null && style.has("size")) + { + spec.setDefaultFixedFontSize(style.optInt("size", 16)); + } + + if (SDK_INT >= 21) + { spec.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); CookieManager.getInstance().setAcceptThirdPartyCookies(view, true); }