OpenPrinting / cups

OpenPrinting CUPS Sources
https://openprinting.github.io/cups
Apache License 2.0
1k stars 178 forks source link

Feature to enable scale-to-fit only for buggy iOS IPP clients (AirPrint) #822

Closed ValdikSS closed 9 months ago

ValdikSS commented 9 months ago

Is your feature request related to a problem? Please describe.

cups-filters set scale-to-fit printing mode by default since 2012.

IMAGE PRINTING DEFAULT CHANGED TO "SCALE TO FIT"

Compared to the PostScript-based original CUPS filters there is a change of deafults: The imagetopdf and imagetoraster filters print in "scale-to-fit" mode (image is scaled to fill one page but nothing of the image being cut off) by default.

This is done to support photo printing via AirPrint. The photo apps on Apple's iOS devices send print jobs as JPEG images and do not allow to set any options like "scaling" or the page size. With "scale-to-fit" mode set by default, the iOS photos come out on one page, as expected.

To get back to the old behavior, supply one of the options "nofitplot" "filplot=Off", "nofit-to-page", or "fit-to-page=Off".

This mode forces ghostscript input job processing to scale it before printing, which greatly increase the delay between sending the print job and getting the printout on lower-end devices (CUPS-based print server).

Describe the solution you'd like

Since scale-to-fit was enabled as an attempt to fix image printing on iOS devices, and supposedly only iOS devices are affected and all others do scaling themselves properly, it is possible to enable scale-to-fit option on print-job basis only for print jobs originating from iOS.

As IPP protocol is based on HTTP and iOS devices include their User-Agent header (like User-Agent: CUPS/2.3.0 (iOS 13.6.1; iPhone10,4) IPP/2.0), it should be possible to detect iOS device and force-enable fit-to-page, while making it disabled by default for other clients.

michaelrsweet commented 9 months ago

What should happen is that cups-filters (separate project) correctly implement print-scaling (the option that IPP defines and iOS uses) when scaling images for printing.

We will not be using the User-Agent field to alter the behavior of the CUPS implementation of IPP. Clients can (and do) disable sending of certain User-Agent data for privacy and other reasons, so it isn't a useful/reliable way to detect the type of client. And providing multiple behaviors makes printing fragile and impossible to support.