RHEL-16034 pdftopdf results with (N > 1)^2 copies if a file is sent to IPP printer with collate

Resolves: RHEL-16034
This commit is contained in:
Zdenek Dohnal 2023-12-19 14:41:43 +01:00
parent fa797f8664
commit 700e004ec2
2 changed files with 54 additions and 0 deletions

View File

@ -0,0 +1,49 @@
From a07a43f885a4a7186310639b214c499e09e453c5 Mon Sep 17 00:00:00 2001
From: Till Kamppeter <till.kamppeter@gmail.com>
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 &param) // {{{
} 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

View File

@ -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 <zdohnal@redhat.com> - 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 <zdohnal@redhat.com> - 1.20.0-32
- 2118406 - texttotext filter strips ESC causing PCL files to be printed improperly