summaryrefslogtreecommitdiff
path: root/android/src/com/artifex/mupdfdemo
diff options
context:
space:
mode:
Diffstat (limited to 'android/src/com/artifex/mupdfdemo')
-rw-r--r--android/src/com/artifex/mupdfdemo/MuPDFCore.java27
1 files changed, 6 insertions, 21 deletions
diff --git a/android/src/com/artifex/mupdfdemo/MuPDFCore.java b/android/src/com/artifex/mupdfdemo/MuPDFCore.java
index b74c6593..af726760 100644
--- a/android/src/com/artifex/mupdfdemo/MuPDFCore.java
+++ b/android/src/com/artifex/mupdfdemo/MuPDFCore.java
@@ -38,6 +38,7 @@ public class MuPDFCore
int patchW, int patchH);
private native RectF[] searchPage(String text);
private native TextChar[][][][] text();
+ private native byte[] textAsHtml();
private native void addStrikeOutAnnotationInternal(RectF[] lines);
private native int passClickEventInternal(int page, float x, float y);
private native void setFocusedWidgetChoiceSelectedInternal(String [] selected);
@@ -202,31 +203,15 @@ public class MuPDFCore
public synchronized String html(int page) {
gotoPage(page);
- TextChar[][][][] chars = text();
+ byte chars[] = textAsHtml();
String res = new String();
+ int i;
+ int len = chars.length;
- res += "<html><body style=\"margin:0\"><div style=\"padding:10px\" id=\"content\">";
-
- boolean first = true;
- for (TextChar[][][] bl: chars) {
- if (!first) res += "<p>";
- first = false;
- for (TextChar[][] ln: bl) {
- for (TextChar[] sp: ln) {
- for (TextChar tc: sp) {
- switch (tc.c) {
- case '<': res += "&lt;";break;
- case '>': res += "&gt;";break;
- case '&': res += "&amp;";break;
- default: res += tc.c;
- }
- }
- }
- }
+ for (i = 0; i < len; i++) {
+ res += (char)(chars[i] & 0xFF);
}
- res += "</div></body></html>";
-
return res;
}