OpenPrinting / cups

OpenPrinting CUPS Sources
https://openprinting.github.io/cups
Apache License 2.0
967 stars 177 forks source link

print-scaling not work when using everywhere #862

Closed xiaowen581 closed 6 months ago

xiaowen581 commented 6 months ago

Describe the bug When using some printers added by "everywhere "( Ricoh IM 4000, Epson L8160 etc. ), print-scaling not works. ( not sure others printer-specific option works or not. )

To Reproduce Steps to reproduce the behavior:

  1. add printer: lpadmin -p ricoh_everywhere_lpadmin -m everywhere -v ipp://[IPADDR]/ipp/print -E
  2. print: lp -d ricoh_everywhere_lpadmin -o print-scaling=none -o sides=two-sided-long-edge /path/to/jpeg

Expected behavior print-scaling should works.

System Information:

Information for Ricoh IM 4000

  1. cupsFilter2 in ppd created by "-m everywhere": cupsFilter2: "image/jpeg image/jpeg 0 -" cupsFilter2: "application/vnd.cups-pdf application/pdf 10 -" *cupsFilter2: "image/urf image/urf 100 -"

  2. filters used when printing (no cups-filters was used): [Job 86] 2 filters for job: [Job 86] - (image/jpeg to printer/ricoh_everywhere_lpadmin/image/jpeg, cost 0) [Job 86] - (printer/ricoh_everywhere_lpadmin/image/jpeg to printer/ricoh_everywhere_lpadmin, cost 0) [Job 86] job-sheets=none,none

  3. argv[5] passed to filters: [Job 86] argv[5]="finishings=3 number-up=1 print-color-mode=monochrome print-scaling=none job-uuid=urn:uuid:13ffc524b-3154-6f97-99ae10c9e589 job-originating-host-name=localhost date-time-at-creation= date-time-at-processing= time-at-creation=1704875645 timeprocessing=1704875645 document-name-supplied=text_demo.jpeg ColorModel=Gray cupsPrintQuality=Normal"

  4. argv[14] passed to IPP backend argv[14] = "finishings=3 number-up=1 print-color-mode=monochrome print-scaling=none job-uuid=urn:uuid:13ffcd94-524b-3154-6f97-99ae10c9e589 job-originating-host-name=localhost date-time-at-creation= date-time-at-processing= time-at-creation=1704875645 time-at-processing=1704875645 document-name-supplied=text_demo.jpeg ColorModel=Gray cupsPrintQuality=Normal"

  5. Create-Job ipp packet send to printer: It seems that "sides" was send to printer, but "print-scaling" wasn't. image

  6. result of "ipptool -tv ipp://XXX get-printer-attributes.test" It seems that "print-scaling" was supported by printer and "auto/auto-fit/fill/fit/none" is usable. get-printer-attributes-result.zip

Additional context

  1. When using a brother printer, the cupsFilter2 definition in ppd file is *cupsFilter2: "image/urf image/urf 100 -" and the imagetoXXX filters will be used, then "print-scaling" will be handled by imagetoXXX filters.
  2. I also tried the ricoh printer by: a. cups2.4.7+cups-filters1.28.17+"lpadmin -m everywhere" b. cups2.4.7+cups-filters1.28.17+"lpadmin -m driverless:XXX" c. cups2.4.7+cups-filters2.0.0+"lpadmin -m everywhere" d. cups2.4.7+cups-filters2.0.0+"lpadmin -m driverless:XXX" only "d" pattern use imagetoXXX filters and "print-scaling" works expectedly. BTW, the cupsFilter2 definition in "d" pattern's ppd file is: *cupsFilter2: "image/urf image/urf 0 -" *cupsFilter2: "image/jpeg image/jpeg 0 -"

My Question

  1. Is "-m driverless:XXX" better than "-m everywhere", and should I use "driverless" as much as possible instead of "everywhere"?
  2. Is "cups2.4.7+cups-filters2.0.0+"lpadmin -m driverless:XXX"" the only&right way to solve this issue?
  3. IIUC, if the printer supports print-scaling, it should be work if send "print-scaling: none" to the printer directly in "job-attributes-tag" by "Create-Job" IPP packet, isn't it?
  4. Is the usage "lp -o print-scaling=none XXX" correct? I'm not sure because I can't find it from the follow page. If it's not correct, what's the right way to print an image without scaling? https://www.cups.org/doc/options.html
  5. Is the usage "lp -o print-scaling=none -o position=top-left" correct? (emmm... I have submitted an issue in cups-filters, but not quite sure whether the usage is correct...) https://github.com/OpenPrinting/cups-filters/issues/568
michaelrsweet commented 6 months ago

OK, in this case the backend should be sending all of the print options to the other end. Can you attach the /var/log/cups/error_log file to this issue showing a sample job that isn't getting printed correctly?

Thanks!

xiaowen581 commented 6 months ago

Thanks for your quick reply. Here is the error_log, [Job 86] is this case. Please feel free to let me know if further info needed. P.S. I haven't filter the cupsdCleanJobs log because it seems abnormal and want to report it by the way :) error_log_for_upload.txt

michaelrsweet commented 6 months ago

OK, thanks. So we are in the "send only IPP attributes" mode but the _cupsConvertOptions function isn't handling "print-scaling". Will come up with a fix.

michaelrsweet commented 6 months ago

Fix pushed to master; should apply cleanly to 2.4.x...

[master 3c2f0868c] Fix print-scaling option support for IPP printers (Issue #862)

xiaowen581 commented 6 months ago

Is this means the CUPS-specific options but can not be Converted to standard IPP attributes(or not supported by printer) can not be used? ie.g. “position”. For my case, let "everywhere" use cup-filters may be a better choice...

"imagetopdf" accepts the following CUPS standard options; fitplot mirror PageSize page-left, page-right, page-bottom, page-top OutputOrder Collate sides cupsEvenDuplex position scaling ppi natural-scaling landscape orientation-requested

https://github.com/OpenPrinting/cups-filters

Further more, since CUPS v3 will no longer use cups-filters, is this means “position” will no longer be supported?

CUPS 3.x has a vastly changed architecture (what we call the New Architecture for printing) being all-IPP, only supporting driverless IPP printers and no PPD files and classic CUPS drivers any more. It will not use external filters any more and so will not need this package. https://github.com/OpenPrinting/cups-filters/blob/master/README.md

michaelrsweet commented 6 months ago

@xiaowen581 Aside from the standard IPP options, most of those image filter options have been deprecated a long time. And they are used to format the image for the page that is sent to the printer.