From 9c843e51b1f3366b8016a63cf1b64be95687412d Mon Sep 17 00:00:00 2001 From: Jason Crain Date: Mon, 28 Mar 2016 21:36:52 -0500 Subject: [PATCH] pdftocairo: Calculate rotation before scaling Scaling calculation (-scale-to-x and -scale-to-y) is wrong if a page is rotated. Fix by moving scale calculation to after rotation calculation. bug #94655 --- utils/pdftocairo.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/utils/pdftocairo.cc b/utils/pdftocairo.cc index 47783e8..83eeba0 100644 --- a/utils/pdftocairo.cc +++ b/utils/pdftocairo.cc @@ -1112,6 +1112,11 @@ int main(int argc, char *argv[]) { } } + if ((doc->getPageRotate(pg) == 90) || (doc->getPageRotate(pg) == 270)) { + tmp = pg_w; + pg_w = pg_h; + pg_h = tmp; + } if (scaleTo != 0) { resolution = (72.0 * scaleTo) / (pg_w > pg_h ? pg_w : pg_h); x_resolution = y_resolution = resolution; @@ -1127,11 +1132,6 @@ int main(int argc, char *argv[]) { x_resolution = y_resolution; } } - if ((doc->getPageRotate(pg) == 90) || (doc->getPageRotate(pg) == 270)) { - tmp = pg_w; - pg_w = pg_h; - pg_h = tmp; - } if (imageFileName) { delete imageFileName; imageFileName = NULL; -- 2.7.0