summaryrefslogtreecommitdiff
path: root/platform/java/mupdf_native.c
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@gmail.com>2016-07-18 01:49:58 +0800
committerSebastian Rasmussen <sebras@gmail.com>2016-07-20 23:44:39 +0800
commit7b40777c5dcd4797f795ca6d442d9ec2f47b0c92 (patch)
treefc601fa175db8f6fbe794c18ee62586fcb006059 /platform/java/mupdf_native.c
parent3eb6111be43af64156c43eb55fde8560d5f8e2d7 (diff)
downloadmupdf-7b40777c5dcd4797f795ca6d442d9ec2f47b0c92.tar.xz
JNI: Add DisplayList.toStructuredText().
Diffstat (limited to 'platform/java/mupdf_native.c')
-rw-r--r--platform/java/mupdf_native.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/platform/java/mupdf_native.c b/platform/java/mupdf_native.c
index 03250605..08643b7c 100644
--- a/platform/java/mupdf_native.c
+++ b/platform/java/mupdf_native.c
@@ -4507,6 +4507,35 @@ FUN(DisplayList_toPixmap)(JNIEnv *env, jobject self, jobject jctm, jobject jcs,
}
JNIEXPORT jobject JNICALL
+FUN(DisplayList_toStructuredText)(JNIEnv *env, jobject self)
+{
+ fz_context *ctx = get_context(env);
+ fz_display_list *list = from_DisplayList(env, self);
+ fz_stext_sheet *sheet = NULL;
+ fz_stext_page *text = NULL;
+
+ if (ctx == NULL || list == NULL)
+ return NULL;
+
+ fz_var(sheet);
+
+ fz_try(ctx)
+ {
+ sheet = fz_new_stext_sheet(ctx);
+ text = fz_new_stext_page_from_display_list(ctx, list, sheet);
+ }
+ fz_always(ctx)
+ fz_drop_stext_sheet(ctx, sheet);
+ fz_catch(ctx)
+ {
+ jni_rethrow(env, ctx);
+ return NULL;
+ }
+
+ return to_StructuredText_safe_own(ctx, env, text);
+}
+
+JNIEXPORT jobject JNICALL
FUN(DisplayList_search)(JNIEnv *env, jobject self, jstring jneedle)
{
fz_context *ctx = get_context(env);