From 263f9b79f4e5f49f088777d38f37cc11ff35d52a Mon Sep 17 00:00:00 2001 From: "James R. Barlow" Date: Thu, 18 May 2017 21:52:55 -0700 Subject: [PATCH] pageinfo: debug stuff --- ocrmypdf/pageinfo.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/ocrmypdf/pageinfo.py b/ocrmypdf/pageinfo.py index 53a21b61..9d6e4e29 100644 --- a/ocrmypdf/pageinfo.py +++ b/ocrmypdf/pageinfo.py @@ -226,7 +226,7 @@ def _get_dpi(ctm_shorthand, image_size): image_drawn_width = hypot(a, b) image_drawn_height = hypot(c, d) - # The scale of the image is pixels per PDF unit (1/72") + # The scale of the image is pixels per unit of default user space (1/72") scale_w = image_size[0] / image_drawn_width scale_h = image_size[1] / image_drawn_height @@ -307,11 +307,14 @@ class ImageInfo: if self._comp == '?' and self._enc in ('ccitt', 'jbig2'): self._comp = FRIENDLY_COMP['gray'] - @property def name(self): return self._name + @property + def type_(self): + return self._type + @property def width(self): return self._width @@ -358,6 +361,13 @@ class ImageInfo: else: raise KeyError(item) + def __repr__(self): + class_locals = {attr: getattr(self, attr, None) for attr in dir(self) + if not attr.startswith('_')} + return ( + "").format(**class_locals) + def _find_inline_images(contentsinfo): "Find inline images in the contentstream"