Skip to content

Commit e33b86f

Browse files
mrxrincchristopherdro
authored andcommitted
RTL language support (#87)
* RTL language support now can render and encode persian and arabic languages to. u can set text direction to rtl in ur html code to make it rtl then. * Update PdfConverter.java * Update PdfConverter.java * Update PdfConverter.java
1 parent e0e2567 commit e33b86f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

android/src/main/java/android/print/PdfConverter.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import android.webkit.WebView;
1414
import android.webkit.WebViewClient;
1515

16+
import android.webkit.WebSettings;
1617
import java.io.File;
1718
import android.util.Base64;
1819
import java.io.IOException;
@@ -86,7 +87,9 @@ public void onWriteFinished(PageRange[] pages) {
8687
}
8788
}
8889
});
89-
mWebView.loadDataWithBaseURL(mBaseURL, mHtmlString, "text/HTML", "UTF-8", null);
90+
WebSettings settings = mWebView.getSettings();
91+
settings.setDefaultTextEncodingName("utf-8");
92+
mWebView.loadData(mHtmlString, "text/HTML; charset=utf-8", null);
9093
}
9194

9295
public PrintAttributes getPdfPrintAttrs() {

0 commit comments

Comments
 (0)