From caafb37ddf3d58f4d37d8c7b535021ff18d57861 Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Wed, 13 Jul 2016 19:36:39 +0100 Subject: 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. --- platform/ios/Classes/MuPageViewNormal.m | 3 ++- platform/ios/Classes/MuPageViewReflow.m | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'platform/ios/Classes') 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); -- cgit v1.2.3