diff options
author | Robin Watts <robin.watts@artifex.com> | 2013-02-04 23:26:58 +0000 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2013-02-05 15:52:54 +0000 |
commit | 4d5fa0a3970abdc8522a098fc83263feed16bdd0 (patch) | |
tree | baffd7fc2181e8de73643389cb0e551fdbc4d791 /android/src | |
parent | d13793b9e3511b0a1ada04c1863527e2bc948f1a (diff) | |
download | mupdf-4d5fa0a3970abdc8522a098fc83263feed16bdd0.tar.xz |
Android: Use HTML output in reflow mode.
This gets us styles.
Diffstat (limited to 'android/src')
-rw-r--r-- | android/src/com/artifex/mupdfdemo/MuPDFCore.java | 27 |
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 += "<";break; - case '>': res += ">";break; - case '&': res += "&";break; - default: res += tc.c; - } - } - } - } + for (i = 0; i < len; i++) { + res += (char)(chars[i] & 0xFF); } - res += "</div></body></html>"; - return res; } |