From 1d1962a106b34c76ae4e2d921a87fdb0baad7f14 Mon Sep 17 00:00:00 2001 From: "James R. Barlow" Date: Thu, 17 May 2018 16:50:01 -0700 Subject: [PATCH] weave: fix rescaling logic rotation % 90 == 0 is always true. --- src/ocrmypdf/_weave.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ocrmypdf/_weave.py b/src/ocrmypdf/_weave.py index f45245e5..262028a8 100644 --- a/src/ocrmypdf/_weave.py +++ b/src/ocrmypdf/_weave.py @@ -100,10 +100,10 @@ def _weave_layers_graft( # Because of rounding of DPI, we might get a text layer that is not # identically sized to the target page. Scale to adjust. Normally this # is within 0.998. + if rotation in (90, 270): + wt, ht = ht, wt scale_x = wp / wt scale_y = hp / ht - if rotation % 90 == 0: - scale_x, scale_y = scale_y, scale_x log.debug('%r', (scale_x, scale_y)) scale = pikepdf.PdfMatrix((scale_x, 0, 0, scale_y, 0, 0))