From 700e004ec25c90d8bd1a55e7de93e72784ab2825 Mon Sep 17 00:00:00 2001 From: Zdenek Dohnal Date: Tue, 19 Dec 2023 14:41:43 +0100 Subject: [PATCH] RHEL-16034 pdftopdf results with (N > 1)^2 copies if a file is sent to IPP printer with collate Resolves: RHEL-16034 --- ...rinting-multiple-copies-on-driverles.patch | 49 +++++++++++++++++++ cups-filters.spec | 5 ++ 2 files changed, 54 insertions(+) create mode 100644 0001-pdftopdf-Fixed-printing-multiple-copies-on-driverles.patch diff --git a/0001-pdftopdf-Fixed-printing-multiple-copies-on-driverles.patch b/0001-pdftopdf-Fixed-printing-multiple-copies-on-driverles.patch new file mode 100644 index 0000000..f487740 --- /dev/null +++ b/0001-pdftopdf-Fixed-printing-multiple-copies-on-driverles.patch @@ -0,0 +1,49 @@ +From a07a43f885a4a7186310639b214c499e09e453c5 Mon Sep 17 00:00:00 2001 +From: Till Kamppeter +Date: Tue, 13 Nov 2018 13:04:59 +0100 +Subject: [PATCH] pdftopdf: Fixed printing multiple copies on driverless IPP + printers. + +--- + NEWS | 4 ++++ + filter/pdftopdf/pdftopdf.cc | 24 +++++++++++++++++++----- + 2 files changed, 23 insertions(+), 5 deletions(-) + +diff --git a/filter/pdftopdf/pdftopdf.cc b/filter/pdftopdf/pdftopdf.cc +index f474f08c6..880b664fd 100644 +--- a/filter/pdftopdf/pdftopdf.cc ++++ b/filter/pdftopdf/pdftopdf.cc +@@ -783,11 +783,25 @@ void calculate(ppd_file_t *ppd,ProcessingParameters ¶m) // {{{ + } else if ((ppd)&&(!ppd->manual_copies)) { // hw copy generation available + param.deviceCopies=param.numCopies; + if (param.collate) { // collate requested by user +- // check collate device, with current/final(!) ppd settings +- param.deviceCollate=printerWillCollate(ppd); +- if (!param.deviceCollate) { +- // printer can't hw collate -> we must copy collated in sw +- param.deviceCopies=1; ++ // Check output format (FINAL_CONTENT_TYPE env variable) whether it is ++ // of a driverless IPP printer (PDF, Apple Raster, PWG Raster, PCLm). ++ // These printers do always hardware collate if they do hardware copies. ++ // https://github.com/apple/cups/issues/5433 ++ char *final_content_type = getenv("FINAL_CONTENT_TYPE"); ++ if (final_content_type && ++ (strcasestr(final_content_type, "/pdf") || ++ strcasestr(final_content_type, "/vnd.cups-pdf") || ++ strcasestr(final_content_type, "/pwg-raster") || ++ strcasestr(final_content_type, "/urf") || ++ strcasestr(final_content_type, "/PCLm"))) { ++ param.deviceCollate = true; ++ } else { ++ // check collate device, with current/final(!) ppd settings ++ param.deviceCollate=printerWillCollate(ppd); ++ if (!param.deviceCollate) { ++ // printer can't hw collate -> we must copy collated in sw ++ param.deviceCopies=1; ++ } + } + } // else: printer copies w/o collate and takes care of duplex/evenDuplex + } else { // sw copies +-- +2.43.0 + diff --git a/cups-filters.spec b/cups-filters.spec index 6bbb9d6..d6892b3 100644 --- a/cups-filters.spec +++ b/cups-filters.spec @@ -71,6 +71,8 @@ Patch17: gstoraster-margins.patch Patch18: beh-cve2023.patch # RHEL-19433 Incorrect PS header handling in gstopdf Patch19: 0001-gstoraster-Improved-detection-whether-input-is-PostS.patch +# RHEL-16034 pdftopdf results with (N > 1)^2 copies if a file is sent to IPP printer with collate +Patch20: 0001-pdftopdf-Fixed-printing-multiple-copies-on-driverles.patch %if %{with braille} @@ -248,6 +250,8 @@ The package provides filters and cups-brf backend needed for braille printing. %patch18 -p1 -b .cve202324805 # RHEL-19433 Incorrect PS header handling in gstopdf %patch19 -p1 -b .gstoraster-psdetect +# RHEL-16034 pdftopdf results with (N > 1)^2 copies if a file is sent to IPP printer with collate +%patch20 -p1 -b .pdftopdf-ncopies %build @@ -460,6 +464,7 @@ make check %changelog * Tue Dec 19 2023 Zdenek Dohnal - 1.20.0-33 - RHEL-19433 Incorrect PS header handling in gstopdf +- RHEL-16034 pdftopdf results with (N > 1)^2 copies if a file is sent to IPP printer with collate * Tue Aug 08 2023 Zdenek Dohnal - 1.20.0-32 - 2118406 - texttotext filter strips ESC causing PCL files to be printed improperly