diff options
Diffstat (limited to 'platform')
-rw-r--r-- | platform/android/viewer/jni/mupdf.c | 10 | ||||
-rw-r--r-- | platform/ios/Classes/MuPageViewNormal.m | 3 | ||||
-rw-r--r-- | platform/ios/Classes/MuPageViewReflow.m | 3 | ||||
-rw-r--r-- | platform/ios/common.m | 4 | ||||
-rw-r--r-- | platform/x11/pdfapp.c | 3 |
5 files changed, 15 insertions, 8 deletions
diff --git a/platform/android/viewer/jni/mupdf.c b/platform/android/viewer/jni/mupdf.c index b70d3f1a..91a002e3 100644 --- a/platform/android/viewer/jni/mupdf.c +++ b/platform/android/viewer/jni/mupdf.c @@ -1251,13 +1251,15 @@ JNI_FN(MuPDFCore_searchPage)(JNIEnv * env, jobject thiz, jstring jtext) fz_try(ctx) { + fz_rect mediabox; + if (glo->hit_bbox == NULL) glo->hit_bbox = fz_malloc_array(ctx, MAX_SEARCH_HITS, sizeof(*glo->hit_bbox)); zoom = glo->resolution / 72; fz_scale(&ctm, zoom, zoom); sheet = fz_new_stext_sheet(ctx); - text = fz_new_stext_page(ctx); + text = fz_new_stext_page(ctx, fz_bound_page(ctx, page, &mediabox)); dev = fz_new_stext_device(ctx, sheet, text); fz_run_page(ctx, pc->page, dev, &ctm, NULL); fz_drop_device(ctx, dev); @@ -1342,12 +1344,13 @@ JNI_FN(MuPDFCore_text)(JNIEnv * env, jobject thiz) fz_try(ctx) { + fz_rect mediabox; int b, l, s, c; zoom = glo->resolution / 72; fz_scale(&ctm, zoom, zoom); sheet = fz_new_stext_sheet(ctx); - text = fz_new_stext_page(ctx); + text = fz_new_stext_page(ctx, fz_bound_page(ctx, page, &mediabox)); dev = fz_new_stext_device(ctx, sheet, text); fz_run_page(ctx, pc->page, dev, &ctm, NULL); fz_drop_device(ctx, dev); @@ -1451,11 +1454,12 @@ JNI_FN(MuPDFCore_textAsHtml)(JNIEnv * env, jobject thiz) fz_try(ctx) { + fz_rect mediabox; int b, l, s, c; ctm = fz_identity; sheet = fz_new_stext_sheet(ctx); - text = fz_new_stext_page(ctx); + text = fz_new_stext_page(ctx, fz_bound_page(ctx, page, &mediabox)); dev = fz_new_stext_device(ctx, sheet, text); fz_run_page(ctx, pc->page, dev, &ctm, NULL); fz_drop_device(ctx, dev); diff --git a/platform/ios/Classes/MuPageViewNormal.m b/platform/ios/Classes/MuPageViewNormal.m index b9da24e5..c56ad840 100644 --- a/platform/ios/Classes/MuPageViewNormal.m +++ b/platform/ios/Classes/MuPageViewNormal.m @@ -72,10 +72,11 @@ static NSArray *enumerateWords(fz_document *doc, fz_page *page) fz_try(ctx) { + fz_rect mediabox; int b, l, c; sheet = fz_new_stext_sheet(ctx); - text = fz_new_stext_page(ctx); + text = fz_new_stext_page(ctx, fz_bound_page(ctx, page, &mediabox)); dev = fz_new_stext_device(ctx, sheet, text); fz_run_page(ctx, page, dev, &fz_identity, NULL); fz_drop_device(ctx, dev); diff --git a/platform/ios/Classes/MuPageViewReflow.m b/platform/ios/Classes/MuPageViewReflow.m index 9378da61..86905b03 100644 --- a/platform/ios/Classes/MuPageViewReflow.m +++ b/platform/ios/Classes/MuPageViewReflow.m @@ -11,6 +11,7 @@ NSString *textAsHtml(fz_document *doc, int pageNum) fz_matrix ctm; fz_buffer *buf = NULL; fz_output *out = NULL; + fz_rect mediabox; fz_var(page); fz_var(sheet); @@ -23,7 +24,7 @@ NSString *textAsHtml(fz_document *doc, int pageNum) { ctm = fz_identity; sheet = fz_new_stext_sheet(ctx); - text = fz_new_stext_page(ctx); + text = fz_new_stext_page(ctx, fz_bound_page(ctx, page, &mediabox)); dev = fz_new_stext_device(ctx, sheet, text); page = fz_load_page(ctx, doc, pageNum); fz_run_page(ctx, page, dev, &ctm, NULL); diff --git a/platform/ios/common.m b/platform/ios/common.m index 6ee3653f..80c2c738 100644 --- a/platform/ios/common.m +++ b/platform/ios/common.m @@ -20,9 +20,9 @@ static fz_rect hit_bbox[500]; int search_page(fz_document *doc, int number, char *needle, fz_cookie *cookie) { fz_page *page = fz_load_page(ctx, doc, number); - + fz_rect mediabox; fz_stext_sheet *sheet = fz_new_stext_sheet(ctx); - fz_stext_page *text = fz_new_stext_page(ctx); + fz_stext_page *text = fz_new_stext_page(ctx, fz_bound_page(ctx, page, &mediabox)); fz_device *dev = fz_new_stext_device(ctx, sheet, text); fz_run_page(ctx, page, dev, &fz_identity, cookie); fz_drop_device(ctx, dev); diff --git a/platform/x11/pdfapp.c b/platform/x11/pdfapp.c index 431c9994..e3e9ccc5 100644 --- a/platform/x11/pdfapp.c +++ b/platform/x11/pdfapp.c @@ -843,6 +843,7 @@ static void pdfapp_showpage(pdfapp_t *app, int loadpage, int drawpage, int repai if (loadpage) { + fz_rect mediabox; pdfapp_loadpage(app, searching); /* Zero search hit position */ @@ -850,7 +851,7 @@ static void pdfapp_showpage(pdfapp_t *app, int loadpage, int drawpage, int repai /* Extract text */ app->page_sheet = fz_new_stext_sheet(app->ctx); - app->page_text = fz_new_stext_page(app->ctx); + app->page_text = fz_new_stext_page(app->ctx, fz_bound_page(app->ctx, app->page, &mediabox)); if (app->page_list || app->annotations_list) { |