diff --git a/ppd/ppd-generator.c b/ppd/ppd-generator.c index a815030..637e7b5 100644 --- a/ppd/ppd-generator.c +++ b/ppd/ppd-generator.c @@ -703,7 +703,8 @@ ppdCreatePPDFromIPP2(char *buffer, // I - Filename buffer is_pdf = 1; } #ifdef CUPS_RASTER_HAVE_APPLERASTER - else if (cupsArrayFind(pdl_list, "image/urf")) + else if (cupsArrayFind(pdl_list, "image/urf") && + (ippFindAttribute(supported, "urf-supported", IPP_TAG_KEYWORD) != NULL)) { int resStore = 0; // Variable for storing the no. of resolutions in the resolution array int resArray[__INT16_MAX__]; // Creating a resolution array supporting a maximum of 32767 resolutions. @@ -830,44 +831,38 @@ ppdCreatePPDFromIPP2(char *buffer, // I - Filename buffer formatfound = 1; is_pdf = 1; } - else if (cupsArrayFind(pdl_list, "image/pwg-raster")) + else if (cupsArrayFind(pdl_list, "image/pwg-raster") && + ippFindAttribute(supported, "pwg-raster-document-type-supported", IPP_TAG_KEYWORD) != NULL && + (attr = ippFindAttribute(supported, "pwg-raster-document-resolution-supported", IPP_TAG_RESOLUTION)) != NULL) { - if ((attr = ippFindAttribute(supported, - "pwg-raster-document-resolution-supported", - IPP_TAG_RESOLUTION)) != NULL) + current_def = NULL; + if ((current_res = cfIPPAttrToResolutionArray(attr)) != NULL && + cfJoinResolutionArrays(&common_res, ¤t_res, &common_def, + ¤t_def)) { - current_def = NULL; - if ((current_res = cfIPPAttrToResolutionArray(attr)) != NULL && - cfJoinResolutionArrays(&common_res, ¤t_res, &common_def, - ¤t_def)) - { - cupsFilePuts(fp, "*cupsFilter2: \"image/pwg-raster image/pwg-raster 0 -\"\n"); - if (formatfound == 0) manual_copies = 1; - formatfound = 1; - is_pwg = 1; - } + cupsFilePuts(fp, "*cupsFilter2: \"image/pwg-raster image/pwg-raster 0 -\"\n"); + if (formatfound == 0) manual_copies = 1; + formatfound = 1; + is_pwg = 1; } } - else if (cupsArrayFind(pdl_list, "application/PCLm")) + else if (cupsArrayFind(pdl_list, "application/PCLm") && + (attr = ippFindAttribute(supported, "pclm-source-resolution-supported", IPP_TAG_RESOLUTION)) != NULL) { - if ((attr = ippFindAttribute(supported, "pclm-source-resolution-supported", - IPP_TAG_RESOLUTION)) != NULL) + if ((defattr = ippFindAttribute(supported, + "pclm-source-resolution-default", + IPP_TAG_RESOLUTION)) != NULL) + current_def = cfIPPResToResolution(defattr, 0); + else + current_def = NULL; + if ((current_res = cfIPPAttrToResolutionArray(attr)) != NULL && + cfJoinResolutionArrays(&common_res, ¤t_res, &common_def, + ¤t_def)) { - if ((defattr = ippFindAttribute(supported, - "pclm-source-resolution-default", - IPP_TAG_RESOLUTION)) != NULL) - current_def = cfIPPResToResolution(defattr, 0); - else - current_def = NULL; - if ((current_res = cfIPPAttrToResolutionArray(attr)) != NULL && - cfJoinResolutionArrays(&common_res, ¤t_res, &common_def, - ¤t_def)) - { - cupsFilePuts(fp, "*cupsFilter2: \"application/PCLm application/PCLm 0 -\"\n"); - if (formatfound == 0) manual_copies = 1; - formatfound = 1; - is_pclm = 1; - } + cupsFilePuts(fp, "*cupsFilter2: \"application/PCLm application/PCLm 0 -\"\n"); + if (formatfound == 0) manual_copies = 1; + formatfound = 1; + is_pclm = 1; } } // Legacy formats only if we have no driverless format