cups icon indicating copy to clipboard operation
cups copied to clipboard

number-up applied twice with Apple clients

Open dkosovic opened this issue 1 year ago • 1 comments

Unfortunately, when the _cups mDNS subtype is used, no AirPrint queues get automatically generated for macOS clients, which then requires the print driver to be installed automatically through Apple Updates if available or they have to be preinstalled or manually installed.

Consequently, many sites with Macs drop advertising the _cups mDNS subtype to take advantage of automatically generated AirPrint queues, unfortunately number-up gets applied twice when the _cups mDNS subtype is not used.

I'm hoping something like the following patch could be applied to prevent number-up getting applied twice, I've tested it with macOS and iOS clients. I used the com.apple.print.totalPages..n. option just to determine it was an Apple client and only then exclude the listed options if _cups mDNS subtype is not being advertised. The excluded options are based on what cups-filters' pdftops excludes (not sure if all of the options should be excluded or not):

  • https://github.com/OpenPrinting/cups-filters/blob/eae766df3267608844fa7809ece38a3922b3e070/filter/pdftops.c#L67
diff --git a/scheduler/job.c b/scheduler/job.c
index 49e4fa337..cb8fc01ac 100644
--- a/scheduler/job.c
+++ b/scheduler/job.c
@@ -4004,6 +4004,47 @@ get_options(cupsd_job_t *job,		/* I - Job */
 	  banner_page)
         continue;
 
+#ifdef HAVE_DNSSD
+      /*
+       * When calling a filter, we exclude the following options from its
+       * command line as the Apple client would have applied these options
+       * already if this CUPS server appears as a printer instead of a print
+       * server which occurs when the _cups dns-sd subtype is not used.
+       */
+      if ((!strcmp(attr->name, "crop-to-fit") ||
+           !strcmp(attr->name, "fill") ||
+           !strcmp(attr->name, "fitplot") ||
+           !strcmp(attr->name, "fit-to-page") ||
+           !strcmp(attr->name, "landscape") ||
+           !strcmp(attr->name, "orientation-requested") ||
+           !strcmp(attr->name, "brightness") ||
+           !strcmp(attr->name, "cupsEvenDuplex") ||
+           !strcmp(attr->name, "gamma") ||
+           !strcmp(attr->name, "hue") ||
+           !strcmp(attr->name, "ipp-attribute-fidelity") ||
+           !strcmp(attr->name, "MirrorPrint") ||
+           !strcmp(attr->name, "mirror") ||
+           !strcmp(attr->name, "multiple-document-handling") ||
+           !strcmp(attr->name, "natural-scaling") ||
+           !strcmp(attr->name, "number-up") ||
+           !strcmp(attr->name, "number-up-layout") ||
+           !strcmp(attr->name, "OutputOrder") ||
+           !strcmp(attr->name, "page-border") ||
+           !strcmp(attr->name, "page-bottom") ||
+           !strcmp(attr->name, "page-label") ||
+           !strcmp(attr->name, "page-left") ||
+           !strcmp(attr->name, "page-ranges") ||
+           !strcmp(attr->name, "page-right") ||
+           !strcmp(attr->name, "page-set") ||
+           !strcmp(attr->name, "page-top") ||
+           !strcmp(attr->name, "position") ||
+           !strcmp(attr->name, "saturation") ||
+           !strcmp(attr->name, "scaling")) &&
+          strstr(DNSSDSubTypes, "_cups") == NULL &&
+          ippFindAttribute(job->attrs, "com.apple.print.totalPages..n.", IPP_TAG_ZERO))
+        continue;
+#endif /* HAVE_DNSSD */
+
      /*
       * Otherwise add them to the list...
       */

dkosovic avatar May 31 '24 07:05 dkosovic

This is an issue for us as well.

csfjeff avatar Jun 25 '24 18:06 csfjeff

Unfortunately, this problem needs to be fixed at the macOS client side since they are sending number-up and other options.

If you don't use Mac-specific PPD files on the print server then the Apple client won't need any Mac drivers to be installed. At least that is a workaround until Apple fixes AirPrint -> CUPS support.

michaelrsweet avatar Aug 14 '24 04:08 michaelrsweet