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

cupsfilters/pdftopdf/pdftopdf_processor.cc

index 0be531387fe4a0a9f9579da56222177c1d9e3348..3553833d2049ef4a652542f459dae26be9dc6053 100644 (file)
@@ -174,12 +174,14 @@ bool processPDFTOPDF(PDFTOPDF_Processor &proc,ProcessingParameters &param,pdftop
     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(doc);