From 559e5269d2ecadf06584310830b5898e60cbc7b2 Mon Sep 17 00:00:00 2001 From: "James R. Barlow" Date: Mon, 29 Oct 2018 23:30:53 -0700 Subject: [PATCH] Ensure inline image is parsed correctly Requires pikepdf > 0.3.6 --- src/ocrmypdf/_weave.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ocrmypdf/_weave.py b/src/ocrmypdf/_weave.py index c719796e..995878b6 100644 --- a/src/ocrmypdf/_weave.py +++ b/src/ocrmypdf/_weave.py @@ -75,8 +75,13 @@ def strip_invisible_text(pdf, page, log): return str(op).encode('ascii') lines = [] + for operands, operator in stream: - line = b' '.join(convert(op) for op in operands) + b' ' + operator.unparse() + if operator == pikepdf.Operator('INLINE IMAGE'): + iim = operands[0] + line = iim.unparse() + else: + line = b' '.join(convert(op) for op in operands) + b' ' + operator.unparse() lines.append(line) content_stream = b'\n'.join(lines)