OpenPrinting / cups-filters

filters, backends, driverless utility, ... - Everything which CUPS 2.x needs to be used on non-Mac systems
Apache License 2.0
161 stars 126 forks source link

Borderless printing to Canon SELPHY CP1500 photo printer (driverless) #492

Closed porst17 closed 1 year ago

porst17 commented 1 year ago

I am trying to set up the Canon SELPHY CP1500 network photo printer on Ubuntu 22.04 (cups 2.4.1) for borderless printing. When printing on macOS, the print dialog offers borderless medias in the media selection dialog. When printing on Android (Mopria), there is a dedicated toggle for "Borderless".

On Linux, however, there is neither "borderless" media to select nor a dedicated "Borderless" option. In the CUPS web interface, the printer's Make and Model is listed as "Canon SELPHY CP1500 HTTP, driverless, cups-filters 1.28.15".

The generated PPD file (internally via the driverless command?) contains the line

*ImageableArea Postcard: "18 36 265.464566929134 383.527559055118"
*PaperDimension Postcard: "283.464566929134 419.527559055118"

and all photo prints have a white margin around the actual content.

After editing the PPD by hand and setting

*ImageableArea Postcard: "0 0 283.464566929134 419.527559055118"

the photos are printed borderless as expected.

I also played with ipptool and was able to send JPEG images directly to the printer using the following IPP file:

{
 OPERATION Print-Job
 GROUP operation-attributes-tag
  ATTR charset attributes-charset utf-8
  ATTR language attributes-natural-language en
  ATTR uri printer-uri $uri

  GROUP job-attributes-tag
  ATTR collection media-col {
  MEMBER integer media-top-margin 0
  MEMBER integer media-bottom-margin 0
  MEMBER integer media-left-margin 0
  MEMBER integer media-right-margin 0
 }

 FILE $filename
}

Images send this way are also printed borderless on the CP1500.

There seems to be something wrong with how the ImageableArea of the PPD is determined.

For debugging purposes, I attached the PPD output and debug log of

driverless -d ipp://CP1500fa052c.local:631/ipp/print > Canon-SELPHY-CP1500.ppd 2> debug.log

The PPD generated by the above is identical to /etc/cups/ppd/Canon-SELPHY-CP1500.ppd.

Canon-SELPHY-CP1500.ppd:

*PPD-Adobe: "4.3"
*FormatVersion: "4.3"
*FileVersion: "1.28.15"
*LanguageVersion: English
*LanguageEncoding: ISOLatin1
*PSVersion: "(3010.000) 0"
*LanguageLevel: "3"
*FileSystem: False
*PCFileName: "drvless.ppd"
*Manufacturer: "Canon"
*ModelName: "Canon SELPHY CP1500 HTTP"
*Product: "(Canon SELPHY CP1500 HTTP)"
*NickName: "Canon SELPHY CP1500 HTTP, driverless, cups-filters 1.28.15"
*ShortNickName: "Canon SELPHY CP1500 HTTP"
*DefaultOutputOrder: Reverse
*ColorDevice: True
*cupsVersion: 2.4
*cupsSNMPSupplies: False
*cupsLanguages: "en"
*APSupplies: "http://CP1500fa052c.local:8008/index.html"
*cupsFilter2: "image/urf image/urf 0 -"
*cupsFilter2: "image/pwg-raster image/pwg-raster 10 -"
*cupsFilter2: "image/jpeg image/jpeg 0 -"
*cupsManualCopies: True
*OpenUI *PageSize/Media Size: PickOne
*OrderDependency: 10 AnySetup *PageSize
*DefaultPageSize: Postcard
*PageSize 54x86mm: "<</PageSize[153.070866141732 243.779527559055]>>setpagedevice"
*PageSize 89x119mm: "<</PageSize[252.283464566929 337.322834645669]>>setpagedevice"
*PageSize Postcard/Hagaki: "<</PageSize[283.464566929134 419.527559055118]>>setpagedevice"
*CloseUI: *PageSize
*OpenUI *PageRegion/Media Size: PickOne
*OrderDependency: 10 AnySetup *PageRegion
*DefaultPageRegion: Postcard
*PageRegion 54x86mm: "<</PageSize[153.070866141732 243.779527559055]>>setpagedevice"
*PageRegion 89x119mm: "<</PageSize[252.283464566929 337.322834645669]>>setpagedevice"
*PageRegion Postcard/Hagaki: "<</PageSize[283.464566929134 419.527559055118]>>setpagedevice"
*CloseUI: *PageRegion
*DefaultImageableArea: Postcard
*DefaultPaperDimension: Postcard
*ImageableArea 54x86mm: "18 36 135.070866141732 207.779527559055"
*PaperDimension 54x86mm: "153.070866141732 243.779527559055"
*ImageableArea 89x119mm: "18 36 234.283464566929 301.322834645669"
*PaperDimension 89x119mm: "252.283464566929 337.322834645669"
*ImageableArea Postcard: "18 36 265.464566929134 383.527559055118"
*PaperDimension Postcard: "283.464566929134 419.527559055118"
*HWMargins: "18 36 18 36"
*ParamCustomPageSize Width: 1 points 150.236220472441 289.133858267717
*ParamCustomPageSize Height: 2 points 240.944881889764 433.700787401575
*ParamCustomPageSize WidthOffset: 3 points 0 0
*ParamCustomPageSize HeightOffset: 4 points 0 0
*ParamCustomPageSize Orientation: 5 int 0 3
*CustomPageSize True: "pop pop pop <</PageSize[5 -2 roll]/ImagingBBox null>>setpagedevice"
*% ColorModel from urf-supported
*OpenUI *ColorModel/Print Color Mode: PickOne
*OrderDependency: 10 AnySetup *ColorModel
*ColorModel Gray/Monochrome: "<</cupsColorSpace 18/cupsBitsPerColor 8/cupsColorOrder 0/cupsCompression 0>>setpagedevice"
*ColorModel RGB/Color: "<</cupsColorSpace 19/cupsBitsPerColor 8/cupsColorOrder 0/cupsCompression 0>>setpagedevice"
*DefaultColorModel: RGB
*CloseUI: *ColorModel
*OpenUI *OutputBin/Output Tray: PickOne
*OrderDependency: 10 AnySetup *OutputBin
*DefaultOutputBin: FaceUp
*OutputBin FaceUp/Face Up: ""
*PageStackOrder FaceUp: Reverse
*CloseUI: *OutputBin
*DefaultResolution: 300dpi
*OpenUI *cupsPrintQuality/Print Quality: PickOne
*OrderDependency: 10 AnySetup *cupsPrintQuality
*DefaultcupsPrintQuality: Normal
*cupsPrintQuality Normal/Normal: "<</HWResolution[300 300]>>setpagedevice"
*CloseUI: *cupsPrintQuality
*OpenUI *print-content-optimize/Print Optimization: PickOne
*OrderDependency: 10 AnySetup *print-content-optimize
*Defaultprint-content-optimize: photo
*print-content-optimize photo/Photo: ""
*print-content-optimize auto/Automatic: ""
*CloseUI: *print-content-optimize
*OpenUI *print-rendering-intent/Print Rendering Intent: PickOne
*OrderDependency: 10 AnySetup *print-rendering-intent
*Defaultprint-rendering-intent: relative
*print-rendering-intent relative/Relative: ""
*print-rendering-intent relative-bpc/Relative w/Black Point Compensation: ""
*CloseUI: *print-rendering-intent
*OpenUI *print-scaling/Print Scaling: PickOne
*OrderDependency: 10 AnySetup *print-scaling
*Defaultprint-scaling: auto
*print-scaling auto/Automatic: ""
*print-scaling auto-fit/Auto-fit: ""
*print-scaling fill/Fill: ""
*print-scaling fit/Fit: ""
*print-scaling none/None: ""
*CloseUI: *print-scaling

debug.log:

DEBUG2: Request for IPP attributes (get-printer-attributes) for printer with URI ipp://CP1500fa052c.local:631/ipp/print failed: No such file or directory
DEBUG2: get-printer-attributes IPP request failed:
DEBUG2:   - No response
DEBUG2: The server doesn't support IPP2.0 request, trying IPP1.1 request
DEBUG2: Request for IPP attributes (get-printer-attributes) for printer with URI ipp://CP1500fa052c.local:631/ipp/print failed: Success
DEBUG2: get-printer-attributes IPP request failed:
DEBUG2:   - No response
DEBUG2: The server doesn't support the standard IPP request, trying request without media-col
DEBUG2: Requested IPP attributes (get-printer-attributes) for printer with URI ipp://CP1500fa052c.local:631/ipp/print
DEBUG2: Full list of all IPP attributes:
DEBUG2:   Attr: attributes-charset
DEBUG2:   Value: utf-8
DEBUG2:   Keyword: utf-8
DEBUG2:   Attr: attributes-natural-language
DEBUG2:   Value: en-us
DEBUG2:   Keyword: en-us
DEBUG2:   Attr: multiple-document-handling-default
DEBUG2:   Value: single-document
DEBUG2:   Keyword: single-document
DEBUG2:   Attr: multiple-document-handling-supported
DEBUG2:   Value: single-document
DEBUG2:   Keyword: single-document
DEBUG2:   Attr: compression-supported
DEBUG2:   Value: none
DEBUG2:   Keyword: none
DEBUG2:   Attr: copies-default
DEBUG2:   Value: 1
DEBUG2:   Attr: copies-supported
DEBUG2:   Value: 1-99
DEBUG2:   Attr: document-format-default
DEBUG2:   Value: image/urf
DEBUG2:   Keyword: image/urf
DEBUG2:   Attr: document-format-supported
DEBUG2:   Value: image/urf,application/octet-stream,image/jpeg,image/pwg-raster
DEBUG2:   Keyword: image/urf
DEBUG2:   Keyword: application/octet-stream
DEBUG2:   Keyword: image/jpeg
DEBUG2:   Keyword: image/pwg-raster
DEBUG2:   Attr: finishings-default
DEBUG2:   Value: none
DEBUG2:   Attr: finishings-supported
DEBUG2:   Value: none
DEBUG2:   Attr: page-ranges-supported
DEBUG2:   Value: false
DEBUG2:   Attr: sides-default
DEBUG2:   Value: one-sided
DEBUG2:   Keyword: one-sided
DEBUG2:   Attr: sides-supported
DEBUG2:   Value: one-sided
DEBUG2:   Keyword: one-sided
DEBUG2:   Attr: number-up-default
DEBUG2:   Value: 1
DEBUG2:   Attr: number-up-supported
DEBUG2:   Value: 1
DEBUG2:   Attr: orientation-requested-default
DEBUG2:   Value: portrait
DEBUG2:   Attr: orientation-requested-supported
DEBUG2:   Value: portrait,landscape,reverse-landscape,reverse-portrait
DEBUG2:   Attr: landscape-orientation-requested-preferred
DEBUG2:   Value: 5
DEBUG2:   Attr: media-default
DEBUG2:   Value: jpn_hagaki_100x148mm
DEBUG2:   Keyword: jpn_hagaki_100x148mm
DEBUG2:   Attr: media-supported
DEBUG2:   Value: jpn_hagaki_100x148mm,om_dsc-photo_89x119mm,om_card_54x86mm,custom_min_53x85mm,custom_max_102x153mm
DEBUG2:   Keyword: jpn_hagaki_100x148mm
DEBUG2:   Keyword: om_dsc-photo_89x119mm
DEBUG2:   Keyword: om_card_54x86mm
DEBUG2:   Keyword: custom_min_53x85mm
DEBUG2:   Keyword: custom_max_102x153mm
DEBUG2:   Attr: media-col-default
DEBUG2:   Value: {media-size={x-dimension=10000 y-dimension=14800} media-bottom-margin=370 media-left-margin=250 media-right-margin=250 media-top-margin=370 media-type=photographic media-source=photo}
DEBUG2:   Attr: media-col-supported
DEBUG2:   Value: media-size,media-bottom-margin,media-left-margin,media-right-margin,media-top-margin,media-type,media-source
DEBUG2:   Keyword: media-size
DEBUG2:   Keyword: media-bottom-margin
DEBUG2:   Keyword: media-left-margin
DEBUG2:   Keyword: media-right-margin
DEBUG2:   Keyword: media-top-margin
DEBUG2:   Keyword: media-type
DEBUG2:   Keyword: media-source
DEBUG2:   Attr: printer-resolution-default
DEBUG2:   Value: 300dpi
DEBUG2:   Attr: printer-resolution-supported
DEBUG2:   Value: 300dpi
DEBUG2:   Attr: print-quality-default
DEBUG2:   Value: normal
DEBUG2:   Attr: print-quality-supported
DEBUG2:   Value: normal
DEBUG2:   Attr: print-scaling-default
DEBUG2:   Value: auto
DEBUG2:   Keyword: auto
DEBUG2:   Attr: print-scaling-supported
DEBUG2:   Value: auto,auto-fit,fill,fit,none
DEBUG2:   Keyword: auto
DEBUG2:   Keyword: auto-fit
DEBUG2:   Keyword: fill
DEBUG2:   Keyword: fit
DEBUG2:   Keyword: none
DEBUG2:   Attr: output-bin-default
DEBUG2:   Value: face-up
DEBUG2:   Keyword: face-up
DEBUG2:   Attr: output-bin-supported
DEBUG2:   Value: face-up
DEBUG2:   Keyword: face-up
DEBUG2:   Attr: output-mode-default
DEBUG2:   Value: color
DEBUG2:   Keyword: color
DEBUG2:   Attr: output-mode-supported
DEBUG2:   Value: auto,color,monochrome,auto-monochrome
DEBUG2:   Keyword: auto
DEBUG2:   Keyword: color
DEBUG2:   Keyword: monochrome
DEBUG2:   Keyword: auto-monochrome
DEBUG2:   Attr: print-color-mode-default
DEBUG2:   Value: color
DEBUG2:   Keyword: color
DEBUG2:   Attr: print-color-mode-supported
DEBUG2:   Value: auto,color,monochrome,auto-monochrome
DEBUG2:   Keyword: auto
DEBUG2:   Keyword: color
DEBUG2:   Keyword: monochrome
DEBUG2:   Keyword: auto-monochrome
DEBUG2:   Attr: print-content-optimize-default
DEBUG2:   Value: photo,auto
DEBUG2:   Keyword: photo
DEBUG2:   Keyword: auto
DEBUG2:   Attr: print-content-optimize-supported
DEBUG2:   Value: photo,auto
DEBUG2:   Keyword: photo
DEBUG2:   Keyword: auto
DEBUG2:   Attr: printer-uri-supported
DEBUG2:   Value: ipp://CP1500fa052c.local:631/ipp/print,ipps://CP1500fa052c.local:443/ipp/print
DEBUG2:   Keyword: ipp://CP1500fa052c.local:631/ipp/print
DEBUG2:   Keyword: ipps://CP1500fa052c.local:443/ipp/print
DEBUG2:   Attr: uri-authentication-supported
DEBUG2:   Value: none,none
DEBUG2:   Keyword: none
DEBUG2:   Keyword: none
DEBUG2:   Attr: uri-security-supported
DEBUG2:   Value: none,tls
DEBUG2:   Keyword: none
DEBUG2:   Keyword: tls
DEBUG2:   Attr: printer-name
DEBUG2:   Value: Canon SELPHY CP1500
DEBUG2:   Keyword: Canon SELPHY CP1500
DEBUG2:   Attr: printer-info
DEBUG2:   Value: Canon SELPHY CP1500
DEBUG2:   Keyword: Canon SELPHY CP1500
DEBUG2:   Attr: printer-more-info
DEBUG2:   Value: http://CP1500fa052c.local:8008/index.html
DEBUG2:   Keyword: http://CP1500fa052c.local:8008/index.html
DEBUG2:   Attr: printer-make-and-model
DEBUG2:   Value: Canon SELPHY CP1500 HTTP
DEBUG2:   Keyword: Canon SELPHY CP1500 HTTP
DEBUG2:   Attr: printer-state
DEBUG2:   Value: idle
DEBUG2:   Attr: printer-state-reasons
DEBUG2:   Value: none
DEBUG2:   Keyword: none
DEBUG2:   Attr: ipp-versions-supported
DEBUG2:   Value: 1.1,2.0
DEBUG2:   Keyword: 1.1
DEBUG2:   Keyword: 2.0
DEBUG2:   Attr: operations-supported
DEBUG2:   Value: Print-Job,Validate-Job,Create-Job,Send-Document,Cancel-Job,Get-Job-Attributes,Get-Jobs,Get-Printer-Attributes,Identify-Printer
DEBUG2:   Attr: multiple-document-jobs-supported
DEBUG2:   Value: false
DEBUG2:   Attr: charset-configured
DEBUG2:   Value: utf-8
DEBUG2:   Keyword: utf-8
DEBUG2:   Attr: charset-supported
DEBUG2:   Value: utf-8,us-ascii
DEBUG2:   Keyword: utf-8
DEBUG2:   Keyword: us-ascii
DEBUG2:   Attr: natural-language-configured
DEBUG2:   Value: en-us
DEBUG2:   Keyword: en-us
DEBUG2:   Attr: generated-natural-language-supported
DEBUG2:   Value: en-us
DEBUG2:   Keyword: en-us
DEBUG2:   Attr: printer-is-accepting-jobs
DEBUG2:   Value: true
DEBUG2:   Attr: queued-job-count
DEBUG2:   Value: 0
DEBUG2:   Attr: color-supported
DEBUG2:   Value: true
DEBUG2:   Attr: pdl-override-supported
DEBUG2:   Value: attempted
DEBUG2:   Keyword: attempted
DEBUG2:   Attr: printer-up-time
DEBUG2:   Value: 6027
DEBUG2:   Attr: multiple-operation-time-out
DEBUG2:   Value: 200
DEBUG2:   Attr: job-k-octets-supported
DEBUG2:   Value: 0-10240
DEBUG2:   Attr: job-media-sheets-supported
DEBUG2:   Value: 0-99
DEBUG2:   Attr: pages-per-minute
DEBUG2:   Value: 1
DEBUG2:   Attr: pages-per-minute-color
DEBUG2:   Value: 1
DEBUG2:   Attr: document-format-preferred
DEBUG2:   Value: image/urf
DEBUG2:   Keyword: image/urf
DEBUG2:   Attr: job-creation-attributes-supported
DEBUG2:   Value: copies,finishings,job-name,media,media-col,orientation-requested,output-bin,print-color-mode,print-quality,printer-resolution,sides,ipp-attribute-fidelity
DEBUG2:   Keyword: copies
DEBUG2:   Keyword: finishings
DEBUG2:   Keyword: job-name
DEBUG2:   Keyword: media
DEBUG2:   Keyword: media-col
DEBUG2:   Keyword: orientation-requested
DEBUG2:   Keyword: output-bin
DEBUG2:   Keyword: print-color-mode
DEBUG2:   Keyword: print-quality
DEBUG2:   Keyword: printer-resolution
DEBUG2:   Keyword: sides
DEBUG2:   Keyword: ipp-attribute-fidelity
DEBUG2:   Attr: jpeg-k-octets-supported
DEBUG2:   Value: 0-32768
DEBUG2:   Attr: jpeg-x-dimension-supported
DEBUG2:   Value: 64-15000
DEBUG2:   Attr: jpeg-y-dimension-supported
DEBUG2:   Value: 64-15000
DEBUG2:   Attr: media-ready
DEBUG2:   Value: jpn_hagaki_100x148mm
DEBUG2:   Keyword: jpn_hagaki_100x148mm
DEBUG2:   Attr: media-col-ready
DEBUG2:   Value: {media-size={x-dimension=10000 y-dimension=14800} media-bottom-margin=370 media-left-margin=250 media-right-margin=250 media-top-margin=370 media-type=photographic media-source=photo},{media-size={x-dimension=10000 y-dimension=14800} media-bottom-margin=0 media-left-margin=0 media-right-margin=0 media-top-margin=0 media-type=photographic media-source=photo}
DEBUG2:   Attr: media-type-supported
DEBUG2:   Value: photographic
DEBUG2:   Keyword: photographic
DEBUG2:   Attr: pdf-versions-supported
DEBUG2:   Value: none
DEBUG2:   Keyword: none
DEBUG2:   Attr: printer-dns-sd-name
DEBUG2:   Value: Canon SELPHY CP1500
DEBUG2:   Keyword: Canon SELPHY CP1500
DEBUG2:   Attr: printer-supplies-info
DEBUG2:   Value: http://CP1500fa052c.local:8008/supply/ink_content.html
DEBUG2:   Keyword: http://CP1500fa052c.local:8008/supply/ink_content.html
DEBUG2:   Attr: printer-uuid
DEBUG2:   Value: urn:uuid:8d5c2600-762e-4d80-8d80-5c625afa052c
DEBUG2:   Keyword: urn:uuid:8d5c2600-762e-4d80-8d80-5c625afa052c
DEBUG2:   Attr: urf-supported
DEBUG2:   Value: W8,SRGB24,V1.5,RS300,IS7,MT11,PQ4,OB9,IFU0,OFU0,CP99
DEBUG2:   Keyword: W8
DEBUG2:   Keyword: SRGB24
DEBUG2:   Keyword: V1.5
DEBUG2:   Keyword: RS300
DEBUG2:   Keyword: IS7
DEBUG2:   Keyword: MT11
DEBUG2:   Keyword: PQ4
DEBUG2:   Keyword: OB9
DEBUG2:   Keyword: IFU0
DEBUG2:   Keyword: OFU0
DEBUG2:   Keyword: CP99
DEBUG2:   Attr: printer-geo-location
DEBUG2:   Value: geo:0.0000000,0.0000000,0;u=0
DEBUG2:   Keyword: geo:0.0000000,0.0000000,0;u=0
DEBUG2:   Attr: printer-firmware-name
DEBUG2:   Value: External Firm ver, Internal Firm ver
DEBUG2:   Keyword: External Firm ver, Internal Firm ver
DEBUG2:   Attr: printer-firmware-patches
DEBUG2:   Value:
DEBUG2:   Keyword:
DEBUG2:   Attr: printer-firmware-string-version
DEBUG2:   Value: 1.0.1.0, 1.32
DEBUG2:   Keyword: 1.0.1.0, 1.32
DEBUG2:   Attr: printer-firmware-version
DEBUG2:   Value: 01000100,0120
DEBUG2:   Attr: feed-orientation-default
DEBUG2:   Value: short-edge-first
DEBUG2:   Keyword: short-edge-first
DEBUG2:   Attr: feed-orientation-supported
DEBUG2:   Value: short-edge-first
DEBUG2:   Keyword: short-edge-first
DEBUG2:   Attr: ipp-features-supported
DEBUG2:   Value: airprint-1.4,airprint-1.3,wfds-print-1.0,airprint-1.5,airprint-1.6,airprint-1.7,airprint-1.8,airprint-2.1
DEBUG2:   Keyword: airprint-1.4
DEBUG2:   Keyword: airprint-1.3
DEBUG2:   Keyword: wfds-print-1.0
DEBUG2:   Keyword: airprint-1.5
DEBUG2:   Keyword: airprint-1.6
DEBUG2:   Keyword: airprint-1.7
DEBUG2:   Keyword: airprint-1.8
DEBUG2:   Keyword: airprint-2.1
DEBUG2:   Attr: job-ids-supported
DEBUG2:   Value: true
DEBUG2:   Attr: multiple-operation-time-out-action
DEBUG2:   Value: abort-job
DEBUG2:   Keyword: abort-job
DEBUG2:   Attr: print-rendering-intent-default
DEBUG2:   Value: relative
DEBUG2:   Keyword: relative
DEBUG2:   Attr: print-rendering-intent-supported
DEBUG2:   Value: relative,relative-bpc
DEBUG2:   Keyword: relative
DEBUG2:   Keyword: relative-bpc
DEBUG2:   Attr: printer-config-change-date-time
DEBUG2:   Value: 2015-01-01T00:00:04Z
DEBUG2:   Attr: printer-config-change-time
DEBUG2:   Value: 473385604
DEBUG2:   Attr: printer-get-attributes-supported
DEBUG2:   Value: printer-uri,requesting-user-name,ipp-attribute-fidelity,document-name,compression,document-format,document-natural-language,status-message,detailed-status-message,message,identify-actions,limit,Which-Jobs,my-jobs,last-document,document-password,first-index,job-ids,job-mandatory-attributes,job-hold-until,job-hold-until-default,job-hold-until-supported,multiple-document-handling,multiple-document-handling-default,multiple-document-handling-supported,copies,copies-default,copies-supported,finishings,finishings-default,finishings-supported,page-ranges-supported,sides,sides-default,sides-supported,number-up,number-up-default,number-up-supported,orientation-requested,orientation-requested-default,orientation-requested-supported,landscape-orientation-requested-preferred,media,media-default,media-supported,printer-resolution,printer-resolution-default,printer-resolution-supported,print-quality,print-quality-default,print-quality-supported,job-password,job-password-supported,job-password-encryption,job-password-encryption-supported,media-overprint,media-overprint-type
DEBUG2:   Keyword: printer-uri
DEBUG2:   Keyword: requesting-user-name
DEBUG2:   Keyword: ipp-attribute-fidelity
DEBUG2:   Keyword: document-name
DEBUG2:   Keyword: compression
DEBUG2:   Keyword: document-format
DEBUG2:   Keyword: document-natural-language
DEBUG2:   Keyword: status-message
DEBUG2:   Keyword: detailed-status-message
DEBUG2:   Keyword: message
DEBUG2:   Keyword: identify-actions
DEBUG2:   Keyword: limit
DEBUG2:   Keyword: Which-Jobs
DEBUG2:   Keyword: my-jobs
DEBUG2:   Keyword: last-document
DEBUG2:   Keyword: document-password
DEBUG2:   Keyword: first-index
DEBUG2:   Keyword: job-ids
DEBUG2:   Keyword: job-mandatory-attributes
DEBUG2:   Keyword: job-hold-until
DEBUG2:   Keyword: job-hold-until-default
DEBUG2:   Keyword: job-hold-until-supported
DEBUG2:   Keyword: multiple-document-handling
DEBUG2:   Keyword: multiple-document-handling-default
DEBUG2:   Keyword: multiple-document-handling-supported
DEBUG2:   Keyword: copies
DEBUG2:   Keyword: copies-default
DEBUG2:   Keyword: copies-supported
DEBUG2:   Keyword: finishings
DEBUG2:   Keyword: finishings-default
DEBUG2:   Keyword: finishings-supported
DEBUG2:   Keyword: page-ranges-supported
DEBUG2:   Keyword: sides
DEBUG2:   Keyword: sides-default
DEBUG2:   Keyword: sides-supported
DEBUG2:   Keyword: number-up
DEBUG2:   Keyword: number-up-default
DEBUG2:   Keyword: number-up-supported
DEBUG2:   Keyword: orientation-requested
DEBUG2:   Keyword: orientation-requested-default
DEBUG2:   Keyword: orientation-requested-supported
DEBUG2:   Keyword: landscape-orientation-requested-preferred
DEBUG2:   Keyword: media
DEBUG2:   Keyword: media-default
DEBUG2:   Keyword: media-supported
DEBUG2:   Keyword: printer-resolution
DEBUG2:   Keyword: printer-resolution-default
DEBUG2:   Keyword: printer-resolution-supported
DEBUG2:   Keyword: print-quality
DEBUG2:   Keyword: print-quality-default
DEBUG2:   Keyword: print-quality-supported
DEBUG2:   Keyword: job-password
DEBUG2:   Keyword: job-password-supported
DEBUG2:   Keyword: job-password-encryption
DEBUG2:   Keyword: job-password-encryption-supported
DEBUG2:   Keyword: media-overprint
DEBUG2:   Keyword: media-overprint-type
DEBUG2:   Attr: printer-organization
DEBUG2:   Value: Canon
DEBUG2:   Keyword: Canon
DEBUG2:   Attr: printer-organizational-unit
DEBUG2:   Value: Selphy
DEBUG2:   Keyword: Selphy
DEBUG2:   Attr: printer-state-change-date-time
DEBUG2:   Value: 2000-01-01T00:52:28Z
DEBUG2:   Attr: printer-state-change-time
DEBUG2:   Value: 3148
DEBUG2:   Attr: printer-supply-description
DEBUG2:   Value: Color Ink Ribbon M/N : KP-36IP,Color Ink Ribbon M/N : KL-36IP,Color Ink Ribbon M/N : KC-36IP
DEBUG2:   Keyword: Color Ink Ribbon M/N : KP-36IP
DEBUG2:   Keyword: Color Ink Ribbon M/N : KL-36IP
DEBUG2:   Keyword: Color Ink Ribbon M/N : KC-36IP
DEBUG2:   Attr: pwg-raster-document-resolution-supported
DEBUG2:   Value: 300dpi
DEBUG2:   Attr: pwg-raster-document-type-supported
DEBUG2:   Value: rgb_8
DEBUG2:   Keyword: rgb_8
DEBUG2:   Attr: which-jobs-supported
DEBUG2:   Value: completed,not-completed
DEBUG2:   Keyword: completed
DEBUG2:   Keyword: not-completed
DEBUG2:   Attr: job-preferred-attributes-supported
DEBUG2:   Value: false
DEBUG2:   Attr: printer-location
DEBUG2:   Value:
DEBUG2:   Keyword:
DEBUG2:   Attr: jpeg-features-supported
DEBUG2:   Value: none
DEBUG2:   Keyword: none
DEBUG2:   Attr: job-mandatory-attributes-supported
DEBUG2:   Value: true
DEBUG2:   Attr: job-spooling-supported
DEBUG2:   Value: stream
DEBUG2:   Keyword: stream
DEBUG2:   Attr: printer-detailed-status-messages
DEBUG2:   Value:
DEBUG2:   Keyword:
DEBUG2:   Attr: media-overprint-supported
DEBUG2:   Value:
DEBUG2:   Keyword:
DEBUG2:   Attr: media-overprint-type-supported
DEBUG2:   Value: unknown,unknown
DEBUG2:   Attr: print_wfds
DEBUG2:   Value: T
DEBUG2:   Keyword: T
DEBUG2:   Attr: mopria-certified
DEBUG2:   Value: 2.1
DEBUG2:   Keyword: 2.1
DEBUG2:
DEBUG: PPD generation successful: Apple Raster PPD generated.
DEBUG: Created temporary PPD file: /tmp/01e8463920eff
tillkamppeter commented 1 year ago

Could you run the command

ipptool -tv ipp://CP1500fa052c.local:631/ipp/print get-printer-attributes.test > attrs.txt

and attach the output file attrs.txt here?

porst17 commented 1 year ago

On the Ubuntu machine (now running CUPS 2.4.2), the command fails:

"/usr/share/cups/ipptool/get-printer-attributes.test":
    Get-Printer-Attributes:
        attributes-charset (charset) = utf-8
        attributes-natural-language (naturalLanguage) = en
        printer-uri (uri) = ipp://CP1500fa052c.local:631/ipp/print
        requested-attributes (1setOf keyword) = all,media-col-database
    Get printer attributes using get-printer-attributes                  [FAIL]
        RECEIVED: 0 bytes in response
        status-code = server-error-internal-error (Unable to read response.)
        IPP request failed with status server-error-internal-error (Unable to read response.)

However, on an older MacBook running CUPS 2.2.9, the command results in:

"/usr/share/cups/ipptool/get-printer-attributes.test":
    Get-Printer-Attributes:
        attributes-charset (charset) = utf-8
        attributes-natural-language (naturalLanguage) = en
        printer-uri (uri) = ipp://localhost:6310/ipp/print
    Get printer attributes using Get-Printer-Attributes                  [PASS]
        RECEIVED: 6399 bytes in response
        status-code = successful-ok (successful-ok)
        attributes-charset (charset) = utf-8
        attributes-natural-language (naturalLanguage) = en-us
        charset-configured (charset) = utf-8
        charset-supported (1setOf charset) = utf-8,us-ascii
        color-supported (boolean) = true
        compression-supported (keyword) = none
        copies-default (integer) = 1
        copies-supported (rangeOfInteger) = 1-99
        document-format-default (mimeMediaType) = image/urf
        document-format-supported (1setOf mimeMediaType) = image/urf,application/octet-stream,image/jpeg,image/pwg-raster
        finishings-default (enum) = none
        finishings-supported (enum) = none
        generated-natural-language-supported (naturalLanguage) = en-us
        ipp-versions-supported (1setOf keyword) = 1.1,2.0
        job-creation-attributes-supported (1setOf keyword) = copies,finishings,job-name,media,media-col,orientation-requested,output-bin,print-color-mode,print-quality,printer-resolution,sides,ipp-attribute-fidelity
        jpeg-k-octets-supported (rangeOfInteger) = 0-32768
        jpeg-x-dimension-supported (rangeOfInteger) = 64-15000
        jpeg-y-dimension-supported (rangeOfInteger) = 64-15000
        landscape-orientation-requested-preferred (enum) = 5
        media-col-default (collection) = {media-size={x-dimension=10000 y-dimension=14800} media-bottom-margin=370 media-left-margin=250 media-right-margin=250 media-top-margin=370 media-type=photographic media-source=photo}
        media-bottom-margin-supported (1setOf integer) = 0,370,340,640
        media-left-margin-supported (1setOf integer) = 0,250
        media-right-margin-supported (1setOf integer) = 0,250
        media-top-margin-supported (1setOf integer) = 0,370,340,640
        media-col-supported (1setOf keyword) = media-size,media-bottom-margin,media-left-margin,media-right-margin,media-top-margin,media-type,media-source
        media-default (keyword) = jpn_hagaki_100x148mm
        media-supported (1setOf keyword) = jpn_hagaki_100x148mm,om_dsc-photo_89x119mm,om_card_54x86mm,custom_min_53x85mm,custom_max_102x153mm
        media-source-supported (keyword) = photo
        media-size-supported (1setOf collection) = {x-dimension=10000 y-dimension=14800},{x-dimension=8900 y-dimension=11900},{x-dimension=5400 y-dimension=8600},{x-dimension=5300-10200 y-dimension=8500-15300}
        media-ready (keyword) = jpn_hagaki_100x148mm
        media-col-ready (1setOf collection) = {media-size={x-dimension=10000 y-dimension=14800} media-bottom-margin=370 media-left-margin=250 media-right-margin=250 media-top-margin=370 media-type=photographic media-source=photo},{media-size={x-dimension=10000 y-dimension=14800} media-bottom-margin=0 media-left-margin=0 media-right-margin=0 media-top-margin=0 media-type=photographic media-source=photo}
        media-type-supported (keyword) = photographic
        natural-language-configured (naturalLanguage) = en-us
        operations-supported (1setOf enum) = Print-Job,Validate-Job,Create-Job,Send-Document,Cancel-Job,Get-Job-Attributes,Get-Jobs,Get-Printer-Attributes,Identify-Printer
        orientation-requested-default (enum) = portrait
        orientation-requested-supported (1setOf enum) = portrait,landscape,reverse-landscape,reverse-portrait
        output-bin-default (keyword) = face-up
        output-bin-supported (keyword) = face-up
        output-mode-default (keyword) = color
        output-mode-supported (1setOf keyword) = auto,color,monochrome,auto-monochrome
        pages-per-minute (integer) = 1
        pages-per-minute-color (integer) = 1
        pdf-versions-supported (keyword) = none
        pdl-override-supported (keyword) = attempted
        print-color-mode-default (keyword) = color
        print-color-mode-supported (1setOf keyword) = auto,color,monochrome,auto-monochrome
        print-quality-default (enum) = normal
        print-quality-supported (enum) = normal
        print-scaling-default (keyword) = auto
        print-scaling-supported (1setOf keyword) = auto,auto-fit,fill,fit,none
        printer-icons (1setOf uri) = http://localhost:6310/ipp/icons/48_48.png,http://localhost:6310/ipp/icons/128_128.png,http://localhost:6310/ipp/icons/512_512.png
        printer-is-accepting-jobs (boolean) = true
        printer-info (textWithoutLanguage) = Canon SELPHY CP1500
        printer-location (textWithoutLanguage) =
        printer-make-and-model (textWithoutLanguage) = Canon SELPHY CP1500 HTTP
        printer-more-info (uri) = http://localhost:8008/index.html
        printer-name (nameWithoutLanguage) = Canon SELPHY CP1500
        printer-resolution-default (resolution) = 300dpi
        printer-resolution-supported (resolution) = 300dpi
        printer-supply-info-uri (uri) = http://localhost:8008/supply/ink_content.html
        printer-up-time (integer) = 474
        printer-uri-supported (1setOf uri) = ipp://localhost:631/ipp/print,ipps://localhost:443/ipp/print
        printer-uuid (uri) = urn:uuid:8d5c2600-762e-4d80-8d80-5c625afa052c
        queued-job-count (integer) = 0
        sides-default (keyword) = one-sided
        sides-supported (keyword) = one-sided
        urf-supported (1setOf keyword) = W8,SRGB24,V1.5,RS300,IS7,MT11,PQ4,OB9,IFU0,OFU0,CP99
        uri-authentication-supported (1setOf keyword) = none,none
        uri-security-supported (1setOf keyword) = none,tls
        printer-device-id (textWithoutLanguage) = MFG:Canon;CMD:URF;MDL:SELPHY CP1500;CLS:PRINTER;URF:W8,SRGB24,V1.5,RS300,IS7,MT11,PQ4,OB9,IFU0,OFU0,CP99;
        identify-actions-default (keyword) = flash
        identify-actions-supported (keyword) = flash
        printer-kind (keyword) = photo
        printer-state (enum) = idle
        printer-state-reasons (keyword) = none
        multiple-operation-time-out (integer) = 200
        multiple-document-jobs-supported (boolean) = false
        multiple-document-handling-default (keyword) = single-document
        multiple-document-handling-supported (keyword) = single-document
        ipp-features-supported (1setOf keyword) = airprint-1.4,airprint-1.3,wfds-print-1.0,airprint-1.5,airprint-1.6,airprint-1.7,airprint-1.8,airprint-2.1
        job-ids-supported (boolean) = true
        print-content-optimize-default (1setOf keyword) = photo,auto
        print-content-optimize-supported (1setOf keyword) = photo,auto
        printer-dns-sd-name (nameWithoutLanguage) = Canon SELPHY CP1500
        printer-firmware-name (nameWithoutLanguage) = External Firm ver, Internal Firm ver
        printer-firmware-patches (textWithoutLanguage) =
        printer-firmware-string-version (textWithoutLanguage) = 1.0.1.0, 1.32
        printer-firmware-version (octetString) = 01000100,0120
        printer-geo-location (uri) = geo:0.0000000,0.0000000,0;u=0
        printer-input-tray (octetString) = type=sheetFeedAutoRemovableTray;mediafeed=300;mediaxfeed=300;maxcapacity=18;level=-2;status=0;name=InputTray;index=1;dimunit=tenThousandthsOfInches;unit=sheets;medianame=unknown;mediaweight=-2;mediatype=photographic;mediacolor=white;
        printer-output-tray (octetString) = type=removableBin;maxcapacity=-2;remaining=-2;status=0;name=OutputTray;index=1;dimunit=sheets;unit=sheets;stackingorder=firstToLast;pagedelivery=faceUp;offsetstacking=notPresent;
        printer-supply (octetString) = index=1;class=other;type=inkRibbon;unit=sheets;maxcapacity=36;level=-2;colorantindex=1;colorantrole=other;colorantname=other;coloranttonality=128;
        pwg-raster-document-resolution-supported (resolution) = 300dpi
        pwg-raster-document-type-supported (keyword) = rgb_8
        page-ranges-supported (boolean) = false
        jpeg-features-supported (keyword) = none
        job-mandatory-attributes-supported (boolean) = true
        job-spooling-supported (keyword) = stream
        print_wfds (textWithoutLanguage) = T
        mopria-certified (textWithoutLanguage) = 2.1

The file /usr/share/cups/ipptool/get-printer-attributes.test is different on both machines.

Ubuntu with CUPS 2.4.2:

# Get printer attributes using get-printer-attributes
{
    # The name of the test...
    NAME "Get printer attributes using get-printer-attributes"

    # The resource to use for the POST
    # RESOURCE /admin

    # The operation to use
    OPERATION get-printer-attributes

    # The version to use
    VERSION 2.0

    # Attributes, starting in the operation group...
    GROUP operation
    ATTR charset attributes-charset utf-8
    ATTR language attributes-natural-language en
    ATTR uri printer-uri $uri
    ATTR keyword requested-attributes all,media-col-database

    # What statuses are OK?
    STATUS successful-ok

    # What attributes do we expect?
    EXPECT charset-configured
    EXPECT charset-supported
    EXPECT compression-supported
    EXPECT document-format-default
    EXPECT document-format-supported
    EXPECT generated-natural-language-supported
    EXPECT ipp-versions-supported
    EXPECT media-col-default
    EXPECT natural-language-configured
    EXPECT operations-supported
    EXPECT printer-info
    EXPECT printer-is-accepting-jobs
    EXPECT printer-location
    EXPECT printer-make-and-model
    EXPECT printer-more-info
    EXPECT printer-name
    EXPECT printer-state
    EXPECT printer-state-reasons
    EXPECT printer-up-time
    EXPECT printer-uri-supported
    EXPECT uri-authentication-supported
    EXPECT uri-security-supported
}

MacOS with CUPS 2.2.9:

# Get printer attributes using get-printer-attributes
{
    # The name of the test...
    NAME "Get printer attributes using Get-Printer-Attributes"

    # The operation to use
    OPERATION Get-Printer-Attributes

    # Attributes, starting in the operation group...
    GROUP operation-attributes-tag
    ATTR charset attributes-charset utf-8
    ATTR language attributes-natural-language en
    ATTR uri printer-uri $uri

    # What statuses are OK?
    STATUS successful-ok

    # What attributes do we expect?
    EXPECT charset-configured
    EXPECT charset-supported
    EXPECT compression-supported
    EXPECT document-format-default
    EXPECT document-format-supported
    EXPECT generated-natural-language-supported
    EXPECT ipp-versions-supported
    EXPECT natural-language-configured
    EXPECT operations-supported
    EXPECT pdl-override-supported
    EXPECT printer-is-accepting-jobs
    EXPECT printer-name
    EXPECT printer-state
    EXPECT printer-state-reasons
    EXPECT printer-up-time
    EXPECT printer-uri-supported
    EXPECT queued-job-count
    EXPECT uri-authentication-supported
    EXPECT uri-security-supported
}
porst17 commented 1 year ago

Should I post the results of one of the other ipptootl tests on the CUPS 2.4.2 machine?

$ ls /usr/share/cups/ipptool/
cancel-current-job.test           get-ppds-make-and-model.test             ipp-2.2.test
create-job-format.test            get-ppds-make.test                       ipp-backend.test
create-job-sheets.test            get-ppds-product.test                    ipp-everywhere.test
create-job.test                   get-ppds-psversion.test                  print-job-and-wait.test
create-job-timeout.test           get-ppds.test                            print-job-deflate.test
create-printer-subscription.test  get-ppd.test                             print-job-gzip.test
cups-create-local-printer.test    get-printer-attributes-suite.test        print-job-hold.test
fax-job.test                      get-printer-attributes.test              print-job-letter.test
get-completed-jobs.test           get-printer-description-attributes.test  print-job-manual.test
get-devices.test                  get-printers-printer-id.test             print-job-media-col.test
get-job-attributes2.test          get-printers.test                        print-job-media-needed.test
get-job-attributes.test           get-subscriptions.test                   print-job-password.test
get-jobs.test                     identify-printer-display.test            print-job.test
get-job-template-attributes.test  identify-printer-multiple.test           print-uri.test
get-notifications.test            identify-printer.test                    set-attrs-hold.test
get-ppd-printer.test              ipp-1.1.test                             validate-job.test
get-ppds-drv-only.test            ipp-2.0.test
get-ppds-language.test            ipp-2.1.test
Ankit3002 commented 1 year ago

@porst17 Could you copy the file /usr/share/cups/ipptool/get-printer-attributes.test in your home directory, and then edit the line

ATTR keyword requested-attributes all,media-col-database

in the following ways:

  1. comment it out:

#ATTR keyword requested-attributes all,media-col-database

  1. Remove media-col-database

ATTR keyword requested-attributes all

  1. Remove all

ATTR keyword requested-attributes media-col-database

for each of these cases could you run the below command and attach the resulting files here?

ipptool -tv ipp://CP1500fa052c.local:631/ipp/print~/get-printer-attributes.test > attrs-N.txt

porst17 commented 1 year ago

@Ankit3002 Here are the files you requested.

  1. Commented out: attrs-N-comment.txt
  2. Removed media-col-database: attrs-N-all.txt
  3. Remove all: attrs-N-media-col-database.txt

The first two result in [PASS], the last one in [FAIL].

tillkamppeter commented 1 year ago

I have investigated and found the possible cause of this bug.

The problem was thatthe first margin value in each of the printer IPP attributes media-left/right/top/bottom-margin-supported got ignored and for your printer it happened to be the zero value which indicates borderless printing support.

I have fixed this now via commit 109981f3 on the cups-filters 1.x branch. It was already fixed in the second generation of cups-filters, in libcupsfilters.

If you are familiar with compiling, you could apply the patch and try it out (or take the current GIT state of cups-filters 1.x).

porst17 commented 1 year ago

Thanks for looking into it! I compiled the 1.x branch of cups-filters from source, but it doesn't seem to fix the issue.

./driverless "driverless:ipps://Canon%20SELPHY%20CP1500._ipps._tcp.local/" results in the same cropped ImageableArea:

ImageableArea Postcard: "18 36 265.464566929134 383.527559055118"
PaperDimension Postcard: "283.464566929134 419.527559055118"
tillkamppeter commented 1 year ago

@porst17 Could you run

./driverless -d "driverless:ipps://Canon%20SELPHY%20CP1500._ipps._tcp.local/" > ppd.txt 2>debug.txt

and attach both ppd.txt and debug.txt. Do not package the two files together and do not compress them.

Also make sure that the ./driverless is what you have actually compiled.

tillkamppeter commented 1 year ago

@porst17 could you run the following command and attach attrs.txt?

ipptool --ippserver attrs.txt 'ipps://Canon%20SELPHY%20CP1500._ipps._tcp.local/' get-printer-attributes.test

attrs.txt is now in a special format that anyone having this file can emulate your printer, for example to debug any client software (like cups-filters in this case).

To emulate the printer with the help of your file any user who downloads your file can run the command:

ippeveprinter -a attrs.txt testprinter

and run client software against it:

driverless
driverless ipps://testprinter._ipps._tcp.local/ > out.ppd

to debug the client software ... So, @porst17, could you run the ipptool command I posted here?

tillkamppeter commented 1 year ago

By the way, I have run the above command on my printer, and edited the attrs.txt to resemble the problem of your printer and for me my fix works and I get correct PPD files for borderless printing with both cups-filters 1.x and 2.x. So, @porst17, to find out whether you have perhaps done something wrong with compiling cups-filters with my fix or my fix is not covering your problem I am asking you for the attrs.txt of your printer. My edited, artificial attrs.txt perhaps does not hit the actual problem.

porst17 commented 1 year ago

Here are the files you requested: ppd.txt debug.txt attrs.txt

Note that the command

ipptool --ippserver attrs.txt 'ipps://Canon%20SELPHY%20CP1500._ipps._tcp.local/' get-printer-attributes.test

does not work with this printer. The system's get-printer-attributes.test contains the line

ATTR keyword requested-attributes all,media-col-database

which results in a [FAIL] response (see above), because the printer doesn't seem to support the attribute media-col-database. Therefore, the attrs.txt file has been generated with a modified get-printer-attributes.test that does not require media-col-database, i.e. the modified line reads

ATTR keyword requested-attributes all

I hope this still does the job for debugging purposes.

The ./driverless command I used is the BASH wrapper script present at the top level of the repo (1.x branch) after calling make (the script itself seems generated by libtool and points to the binary in ./.libs). It also utilizes the libcupsfilters.so.1 that's part of the build results (and not the one coming with the OS). If I should call a different executable, let me know.

tillkamppeter commented 1 year ago

Thank you very much, @porst17, and especially also thanks for using the alternative test file without media-col-database. I forgot that detail when asking you to do the last command.

I have found out now why my fix did not work for you. Your printer gives different answers in the case of using ATTR keyword requested-attributes all and of no ATTR keyword requested-attributes ... at all (commented out). Only the latter case, which is what your Mac uses, supplies

        media-bottom-margin-supported (1setOf integer) = 0,370,340,640
        media-left-margin-supported (1setOf integer) = 0,250
        media-right-margin-supported (1setOf integer) = 0,250
        media-top-margin-supported (1setOf integer) = 0,370,340,640

in the answer. This is missing in the former case, which is the one you used for yesterday's command and which libcupsfilters also uses a fallback when it does not get an answer with ATTR keyword requested-attributes all,media-col-database. So requested-attributes=all and not supplying the 'requested-attributes` attribute at all gives different answers.

I based my fix in cups-filters 1.x on you output with media-bottom-margin-supported ... and saw the zero as first item of the list and checking the code I found it got overlooked, which I had fixed. With my test yesterday I confirmed that my fix worked, meaning considering the full lists now.

Now, as I see that the problem persisted for you, I have compared your files which you attached on Jan 9, as they are all the same format, and I discovered what I described above. Before I was simply assuming that all is the default if requested-attributes is not supplied, which is not the case. I did not compare these ~100 lines one by one in the first place, the output looked equal for me at the first glance.

Now the question is, especially also to @michaelrsweet, how does one "correctly" poll the properties of a driverless IPP printer and how does one interpret them correctly?

Important here is especially that requested-attributes all,media-col-database fails for several printers, and that doing several attempts until succeeding or doing several different versions and merging them, will take time and cause problems like OpenPrinting/cups#347.

@michaelrsweet what is Mac OS exactly doing? Two get-printer-attributes requests where the first is without requested-attributes and the second is with requested-attributes media-col-database? Or does it only the first of these two, completely forgetting about media-col-database?

My suggestion for being safest would be two separate request, one without requested-attributes and the second is with requested-attributes media-col-database. But would this double the time to get the complete answer?

And also for the parsing of the answers: Where do I have to loo whether borderless printing is available? media-XXX-margin-supported? media-col-database? media-col-ready? ... and in which priority order?

@michaelrsweet is there a standard on how to poll and how to parse the printer properties data from a driverless IPP printer?

porst17 commented 1 year ago

@tillkamppeter The macOS system I used for comparison is an older one running macOS Mojave and cups 2.2.9, which uses a different get-printer-attributes.test file (see above). This file does not contain the problematic line media-col-database, i.e. the get-printer-attributes.test just doesn't fail with cups 2.2.9 when called against that printer. I can't say anything about newer macOS versions possibly running newer versions of cups.

I don't know if that's what you were asking for, but I wanted to point that out again, just to make sure we are all on the same page.

michaelrsweet commented 1 year ago

@tillkamppeter ALL IPP printers are supposed to support the "requested-attributes" attribute with one or more values representing attribute names or groups of attributes: 'all', 'printer-description', and 'job-template' for Get-Printer-Attributes. This has been part of IPP since v1.0 and is called out in both STD 92 (RFC 8011) for the latest IETF IPP/1.1 and in the PWG specifications for IPP/2.0 and IPP Everywhere, not to mention for Apple's AirPrint. So that is the standard for querying attributes.

A printer that does not support this is broken, and honestly for the ones that are broken it is really hard to come up with a workaround since the "media-col-database" attribute is only returned when explicitly requested since it is so large compared to the other attributes. Conceptually you could do two separate requests (Get-Printer-Attributes without "requested-attributes" and Get-Printer-Attributes with "requested-attributes" = 'media-col-database', which takes less than twice the amount of time), but you have to decide that you'll be maintaining that hack forever (I never wanted to - make the printer vendors fix their f'ing printers!) Plus the current private API we use for PPD generation expects everything in a single IPP response so you'll need to copy the "media-col-database" attribute from the second response to the end of the first response.

The first troubleshooting step for any printer with this problem is to update the firmware on the printer.

The various macOS software lists all of the attributes they care about explicitly in "requested-attributes" or uses the defaults (if "media-col-database" isn't necessary). The macOS "ipp2ppd" program (AirPrint PPD generator) also does multiple Get-Printer-Attributes requests.

WRT detecting borderless support, you want to look at media-col-database and media-col-ready (for loaded media) - not all sizes will support borderless so you look for entries with 0 margins.

porst17 commented 1 year ago

Actually, updating the printer firmware was the first thing I did during the troubleshooting process. The most recent version (1.0.1.0, 1.32) was installed before I opened this issue in the bug tracker.

From a developer perspective, I totally understand that you don't want to introduce special treatments of non-conformant printers. From the perspective of the end-user, there is not much I can do to "fix" broken printer firmware. I could call the Canon 1st-level support, but they will probably not even understand the problem, because "it's just working on Windows, macOS, Android and iOS". 🙁

tillkamppeter commented 1 year ago

@porst17 could you create a queue with the following command:

lpadmin -p testprinter -E -v 'ipps://Canon%20SELPHY%20CP1500._ipps._tcp.local/' -m everywhere

Does this queue allow borderless printing?

This uses CUPS' internal functionality to poll the properties of a driverless IPP printer and to generate the PPD file.

tillkamppeter commented 1 year ago

Parsing "media-col-ready" in addition helps in this case as the borderless variant is listed. The PPD contained the borderles variant only for the paper size currently loaded, though, not for the other sizes. I have commited the change to both libcupsfilters 2.x and cups-filters 1.x now.

tillkamppeter commented 1 year ago

I have also added now a separate poll for "media-col-database" , for the case that it did not get obtained in the first place. This way we get a much higher probability to not miss important info about the printer. Especially we get then borderless only for the sizes actually supporting it, and not for every size when we fall back to "media-size-supported" or "media-supported" due to lack of "media-col-database".

@porst17 can you test with this now? Do you get borderless for all page sizes now?

porst17 commented 1 year ago

I tested 54608f9 (1.x branch) and it works flawlessly. The result of driverless now contains several .Borderless page formats. After system-wide installation of this version of cups-filters, the page formats are also available in the print dialogs of various apps and I have been able to successfully print photos without a visible border on the Canon SELPHY CP1500! Great to see this working! I am really looking forward to the next release! Thanks a lot for your efforts!

tillkamppeter commented 1 year ago

@porst17 thanks a lot for your feedback. One last thing I want to ask you for: Could you attach your print queue's current PPD file (from /etc/cups/ppd/)? Thanks.

@michaelrsweet It seems that having the media-col-database is very important to get complete information about media sizes, margins, ... and what works together. As there are several printers which do not cope with "all,media-col-database" in one get-printer-attributes request, I highly recommend for CUPS to either generally poll "all" and "media-col-database" in separate requests, or when "all,media-col-database" has failed and we are falling back to "all", doing a separate "media-col-database" and if we get a result add that "media-col-database" attribute to the response of the "all" (it is very easy, see my commit 54608f9) and if we get no result, ignore the fact and live with only the answer of "all", without "media-col-database".

porst17 commented 1 year ago

The requested PPD file: SELPHY-CP1500.ppd 🤝

tillkamppeter commented 1 year ago

Thank you very much @porst17 . This looks absolutely correct for me now and shows all 3 page sizes also in a borderless variant. Only with the "media-col-ready" parsing added one gets the borderless variant only for the loaded size, in your case Postcard, with the separate poll of ¨media-col-database" one gets borderless for all sizes.

zdohnal commented 1 year ago

@michaelrsweet , is there a person from Canon in PWG? I recall we (in CUPS) had a similar report, where a Canon printer wasn't able to answer to a request with all, media-col-database response - it looks like a common problem with Canon (here is the issue I was talking about, but I recall they were others, but I didn't have the label for them yet :D ).

In general Canon IPP firmware looks problematic - we have two printers in our office which can't give a valid IPP response (they put a collection into 1setof keyword type attribute...), so having some person in Canon would help.

But I can understand why some people can make a mistake in this (RFC 8011 - Get Printer Attributes operation):

In the request, the Client supplies the set
   of Printer attribute names and/or attribute group names in which the
   requester is interested.

Some people can understand it as the client can ask for attribute names or attribute group names exclusively because of and/or- meaning if the client can ask only for one type of names. Some languages have this 'exclusive or' meaning (f.e. 'Do you want coffee, or tea' and you can't want both) - so probably some developers understood it this way, prohibiting attribute group and attribute combinations. Do you think it can be rephrased? Or is it rephrased in newer PWGs? I haven't seen an additional changes in the newer IPP versions.

tillkamppeter commented 1 year ago

@zdohnal but assuming that this form of mis-understanding is there and is the possible reason why "all,media-col-database" requests fail on many printers does not only explain that these failures are rather common but also justifies that in cups-filters and also in CUPS we should have a fallback to poll the two separately (what I did in cups-filters now) or even poll the two separately in the first place. So I again highly recommend to do this in CUPS, @michaelrsweet ... Such a software workaround can be done by us immediately (as I did in cups-filters), getting all manufacturers fixing their firmware on all models, all users finding out that there is new fixed firmware, ... will take ages or, most probably never get completed ...

michaelrsweet commented 1 year ago

@tillkamppeter Feel free to tackle updating and maintaining this workaround code, but I don't have the bandwidth. And honestly if it was all Canon printers I might be more concerned but so far it looks like a handful of models.

I am forwarding this issue to the Canon PWG rep (Steven Young)...

tillkamppeter commented 1 year ago

@michaelrsweet the addition which I would do to CUPS for the separate poll of "media-col-database" is small, the same ~20 lines I already have added to the two generations of cups-filters. Not much work to add an d maintain. So I think I will do it.

tillkamppeter commented 1 year ago

@michaelrsweet or is the "ultimative" solution for this problem how you are doing in libcups3 in the cupsCopyDestInfo() (file cups/dest-options.c)?

Here you first poll only job-template, media-col-database, and printer-description and not all and media-col-database. You also try a downgrade to version 1.1 as we all are already doing, and repeat up to 10 times in case of the printer being busy.

michaelrsweet commented 1 year ago

@tillkamppeter The printers having trouble with "all,media-col-database" will have the same issues with the other group names...

tillkamppeter commented 1 year ago

So we need to do the same thing in CUPS 3.x ...