summaryrefslogtreecommitdiff
path: root/source/fitz/util.c
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 /source/fitz/util.c
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 'source/fitz/util.c')
-rw-r--r--source/fitz/util.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/source/fitz/util.c b/source/fitz/util.c
index cefac962..ff1464fc 100644
--- a/source/fitz/util.c
+++ b/source/fitz/util.c
@@ -269,8 +269,12 @@ fz_new_stext_page_from_display_list(fz_context *ctx, fz_display_list *list, fz_s
{
fz_stext_page *text;
fz_device *dev;
+ fz_rect mediabox;
- text = fz_new_stext_page(ctx);
+ if (list == NULL)
+ return NULL;
+
+ text = fz_new_stext_page(ctx, fz_bound_display_list(ctx, list, &mediabox));
fz_try(ctx)
{
dev = fz_new_stext_device(ctx, sheet, text);
@@ -295,8 +299,12 @@ fz_new_stext_page_from_page(fz_context *ctx, fz_page *page, fz_stext_sheet *shee
{
fz_stext_page *text;
fz_device *dev;
+ fz_rect *mediabox;
+
+ if (page == NULL)
+ return NULL;
- text = fz_new_stext_page(ctx);
+ text = fz_new_stext_page(ctx, fz_bound_page(ctx, page, &mediabox));
fz_try(ctx)
{
dev = fz_new_stext_device(ctx, sheet, text);