From 32599868df1b3ecd553a0c1bc3e2521dd11b288a Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Thu, 25 May 2017 12:00:21 +0200 Subject: Replace broken FZ_IGNORE_IMAGE hints with other mechanisms. Add an option to the structured text device to preserve images. If the PDF processor does not have ops to process images, then skip loading them in the interpreter if possible. If the device does not have any image callbacks, then don't set the image processing ops in the run device. This accomplishes the same effect as the device hints were intended to do, but without needing to expose them to the PDF interpreter which may not even have a device since we now have multiple PDF op processors. --- include/mupdf/fitz/device.h | 18 +++--------------- include/mupdf/fitz/structured-text.h | 6 ++++++ 2 files changed, 9 insertions(+), 15 deletions(-) (limited to 'include') diff --git a/include/mupdf/fitz/device.h b/include/mupdf/fitz/device.h index d65bfcb8..7e7efb43 100644 --- a/include/mupdf/fitz/device.h +++ b/include/mupdf/fitz/device.h @@ -170,11 +170,6 @@ fz_device *fz_keep_device(fz_context *ctx, fz_device *dev); fz_enable_device_hints : Enable hints in a device. hints: mask of hints to enable. - - For example: By default the draw device renders shadings. For some - purposes (perhaps rendering fast low quality thumbnails) you may want - to tell it to ignore shadings. For this you would enable the - FZ_IGNORE_SHADE hint. */ void fz_enable_device_hints(fz_context *ctx, fz_device *dev, int hints); @@ -182,22 +177,15 @@ void fz_enable_device_hints(fz_context *ctx, fz_device *dev, int hints); fz_disable_device_hints : Disable hints in a device. hints: mask of hints to disable. - - For example: By default the text extraction device ignores images. - For some purposes however (such as extracting HTML) you may want to - enable the capturing of image data too. For this you would disable - the FZ_IGNORE_IMAGE hint. */ void fz_disable_device_hints(fz_context *ctx, fz_device *dev, int hints); enum { /* Hints */ - FZ_IGNORE_IMAGE = 1, - FZ_IGNORE_SHADE = 2, - FZ_DONT_INTERPOLATE_IMAGES = 4, - FZ_MAINTAIN_CONTAINER_STACK = 8, - FZ_NO_CACHE = 16, + FZ_DONT_INTERPOLATE_IMAGES = 1, + FZ_MAINTAIN_CONTAINER_STACK = 2, + FZ_NO_CACHE = 4, }; /* diff --git a/include/mupdf/fitz/structured-text.h b/include/mupdf/fitz/structured-text.h index 6a861faa..26634fff 100644 --- a/include/mupdf/fitz/structured-text.h +++ b/include/mupdf/fitz/structured-text.h @@ -39,11 +39,16 @@ typedef struct fz_stext_page_s fz_stext_page; option is deactivated any type of horizontal whitespace (including horizontal tabs) will be replaced with space characters of variable width. + + FZ_STEXT_PRESERVE_IMAGES: If this option is set, then images will + be stored in the structured text structure. The default is to ignore + all images. */ enum { FZ_STEXT_PRESERVE_LIGATURES = 1, FZ_STEXT_PRESERVE_WHITESPACE = 2, + FZ_STEXT_PRESERVE_IMAGES = 4, }; /* @@ -296,6 +301,7 @@ struct fz_stext_options_s { int flags; }; + /* fz_parse_stext_options: Parse stext device options from a comma separated key-value string. */ -- cgit v1.2.3