From 1ccb70ffcc9982c8dfd44f73562eee4fb152e14b Mon Sep 17 00:00:00 2001 From: Till Kamppeter Date: Sun, 27 Mar 2022 17:57:06 +0200 Subject: [PATCH] pdftopdf: Fix N-up printing with long-edge-first If the printer takes the paper long-edge-first and the number-up option for printing multiple pages per sheet is used, the grid for the shrinked pages onm the output sheet is set wrongly (number of lines and number of columns swapped). This commit fixes the this bug. (manually backported from commit 2477946645ee5511ce88c7e575ecc8334e2be1d3) --- filter/pdftopdf/pdftopdf_processor.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/filter/pdftopdf/pdftopdf_processor.cc b/filter/pdftopdf/pdftopdf_processor.cc index 28643163f..30158b04f 100644 --- a/filter/pdftopdf/pdftopdf_processor.cc +++ b/filter/pdftopdf/pdftopdf_processor.cc @@ -149,12 +149,14 @@ bool processPDFTOPDF(PDFTOPDF_Processor &proc,ProcessingParameters ¶m) // {{ return false; } - if (param.autoRotate) { - const bool dst_lscape = - (param.paper_is_landscape == - ((param.orientation == ROT_0) || (param.orientation == ROT_180))); + const bool dst_lscape = + (param.paper_is_landscape == + ((param.orientation == ROT_0) || (param.orientation == ROT_180))); + if (dst_lscape) + std::swap(param.nup.nupX, param.nup.nupY); + + if (param.autoRotate) proc.autoRotateAll(dst_lscape,param.normal_landscape); - } std::vector> pages=proc.get_pages(); const int numOrigPages=pages.size(); -- 2.47.3