]> git.ipfire.org Git - thirdparty/cups-filters.git/commitdiff
libcupsfilters: Don't call cupsRasterParseIPPOptions() if we have PPD
authorTill Kamppeter <till.kamppeter@gmail.com>
Wed, 9 Feb 2022 17:37:03 +0000 (14:37 -0300)
committerTill Kamppeter <till.kamppeter@gmail.com>
Wed, 9 Feb 2022 17:37:03 +0000 (14:37 -0300)
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
cupsfilters/pclmtoraster.cxx
cupsfilters/pdftoraster.cxx
cupsfilters/raster.c

index 4e84444d6357ccd500dbd79abe74c273c4b03ec7..d08de6c43548d435155dcb9def2ff9a6f1d3f505 100644 (file)
@@ -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);
index 616aeadc7a530b035f348745108c742d082fde1d..ad79ad010aa1d3f69fbbe60f416a79a446ec4c7f 100644 (file)
@@ -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
index 457783d17f6018382a4f1e254090de5a61e73ea3..713a2179ecdf9b220e194710ff88f4ab89f58a30 100644 (file)
@@ -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
index 8d50ad30548b4f0b281380006771e656d119b7cb..f59b1194344889c8a47316abeff0113f86696098 100644 (file)
@@ -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) ||