summaryrefslogtreecommitdiff
path: root/platform/ios
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2016-07-13 19:36:39 +0100
committerRobin Watts <robin.watts@artifex.com>2016-07-13 20:09:13 +0100
commitcaafb37ddf3d58f4d37d8c7b535021ff18d57861 (patch)
treef7d8352640c645266d78c1d72ffdb1a88109d30c /platform/ios
parented8501ed7f52ba96cbdf12594340e629ab99beef (diff)
downloadmupdf-caafb37ddf3d58f4d37d8c7b535021ff18d57861.tar.xz
Bug 696699: Fix Text extraction mediabox information.
Since the removal of the begin_page device function, structured text extraction has been unable to correctly establish the mediabox for extracted pages. Update the fz_new_stext_page call to take this mediabox information. This is an API change, but hopefully most people are calling fz_new_stext_page_from_page or fz_new_stext_page_from_display_list which are updated here to cope. Update all the apps/tools to behave properly.
Diffstat (limited to 'platform/ios')
-rw-r--r--platform/ios/Classes/MuPageViewNormal.m3
-rw-r--r--platform/ios/Classes/MuPageViewReflow.m3
-rw-r--r--platform/ios/common.m4
3 files changed, 6 insertions, 4 deletions
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);