]> git.ipfire.org Git - thirdparty/cups-filters.git/commitdiff
pdftopdf: Fix N-up printing with long-edge-first
authorTill Kamppeter <till.kamppeter@gmail.com>
Sun, 27 Mar 2022 15:57:06 +0000 (17:57 +0200)
committerTill Kamppeter <till.kamppeter@gmail.com>
Sun, 27 Mar 2022 15:57:06 +0000 (17:57 +0200)
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

index 28643163f1d59780b91dfb27103a535fa2111734..30158b04f55a29b862f6231ad32b9de2575a21e3 100644 (file)
@@ -149,12 +149,14 @@ bool processPDFTOPDF(PDFTOPDF_Processor &proc,ProcessingParameters &param) // {{
     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<std::shared_ptr<PDFTOPDF_PageHandle>> pages=proc.get_pages();
   const int numOrigPages=pages.size();