From f472e2984f0af9fa1cac83a760c72c42a631b759 Mon Sep 17 00:00:00 2001 From: Till Kamppeter Date: Wed, 9 Feb 2022 14:37:03 -0300 Subject: [PATCH] libcupsfilters: Don't call cupsRasterParseIPPOptions() if we have PPD In a filter function, when we have a PPD file we should not call cupsRasterParseIPPOptions() as this function guesses the meaning of job options/attributes from their names. This can easily cause problems, for example if we supply "print-color-mode=monochrome" and the function chooses the wromg monochrome color space, one not supported according to the PPD and so not supported by the printer or the (rasterto...) driver. Therefore we remove these calls and trust the PPD's options. In retro-fitting Printer Applications job IPP attributes are associated with appropriate PPD options anyway. --- cupsfilters/mupdftoraster.c | 7 +++---- cupsfilters/pclmtoraster.cxx | 3 --- cupsfilters/pdftoraster.cxx | 2 -- cupsfilters/raster.c | 1 - 4 files changed, 3 insertions(+), 10 deletions(-) diff --git a/cupsfilters/mupdftoraster.c b/cupsfilters/mupdftoraster.c index 4e84444d6..d08de6c43 100644 --- a/cupsfilters/mupdftoraster.c +++ b/cupsfilters/mupdftoraster.c @@ -388,14 +388,13 @@ mupdftoraster (int inputfd, /* I - File descriptor input stream */ Make also sure that the width and height of the page in pixels is the size of the full page (as PWG Raster and MuPDF require it) and not only the printable area (as ppdRasterInterpretPPD() sets, to fulfill - CUPS Raster standard) */ + CUPS Raster standard) + From the header h only cupsWidth/cupsHeight (dimensions in pixels), + resolution, and color space are used here. */ if (ppd) { ppdRasterInterpretPPD(&h, ppd, num_options, options, 0); h.cupsWidth = h.HWResolution[0] * h.PageSize[0] / 72; h.cupsHeight = h.HWResolution[1] * h.PageSize[1] / 72; -#ifdef HAVE_CUPS_1_7 - cupsRasterParseIPPOptions(&h, &curr_data, 1, 0); -#endif /* HAVE_CUPS_1_7 */ } else { #ifdef HAVE_CUPS_1_7 cupsRasterParseIPPOptions(&h, &curr_data, 1, 1); diff --git a/cupsfilters/pclmtoraster.cxx b/cupsfilters/pclmtoraster.cxx index 616aeadc7..ad79ad010 100644 --- a/cupsfilters/pclmtoraster.cxx +++ b/cupsfilters/pclmtoraster.cxx @@ -192,9 +192,6 @@ parseOpts(filter_data_t *data, || !strcasecmp(attr->value, "on") || !strcasecmp(attr->value, "yes"))) pclmtoraster_data->pwgraster = 1; - if (pclmtoraster_data->pwgraster == 1) - cupsRasterParseIPPOptions(header, data, - pclmtoraster_data->pwgraster, 0); #endif /* HAVE_CUPS_1_7 */ } else { #ifdef HAVE_CUPS_1_7 diff --git a/cupsfilters/pdftoraster.cxx b/cupsfilters/pdftoraster.cxx index 457783d17..713a2179e 100644 --- a/cupsfilters/pdftoraster.cxx +++ b/cupsfilters/pdftoraster.cxx @@ -427,8 +427,6 @@ static int parseOpts(filter_data_t *data, || !strcasecmp(attr->value, "on") || !strcasecmp(attr->value, "yes"))) doc->pwgraster = 1; - if (doc->pwgraster == 1) - cupsRasterParseIPPOptions(&(doc->header), data, doc->pwgraster, 0); #endif /* HAVE_CUPS_1_7 */ } else { #ifdef HAVE_CUPS_1_7 diff --git a/cupsfilters/raster.c b/cupsfilters/raster.c index 8d50ad305..f59b11943 100644 --- a/cupsfilters/raster.c +++ b/cupsfilters/raster.c @@ -689,7 +689,6 @@ cupsRasterPrepareHeader(cups_page_header2_t *h, /* I - Raster header */ } if (pwgraster || appleraster || pclm) { - cupsRasterParseIPPOptions(h, data, pwgraster, 0); if ((pwgraster && (ppd_attr = ppdFindAttr(ppd, "cupsPwgRasterDocumentTypeSupported", NULL)) != NULL) || -- 2.47.3