chuckcharlie / cups-avahi-airprint

Docker image for CUPS intended as an AirPrint relay
GNU General Public License v3.0
118 stars 66 forks source link

Incorrect paper size (CUPS assumes A4, etc when printer us US-sized) #28

Open zacs opened 5 months ago

zacs commented 5 months ago

I have my printer working just fine from Mac OS, where the printer defaults to letter size (the only thing the printer can really do).

However when I try to use Airprint, the sheet size options I get are only A4, A5, A6, and envelope. When I print with A4, iOS seems to think everything is fine. But CUPS has no record of the job, even as a failed one.

Any ideas or a way to turn on more verbose logging?

image

image

zacs commented 3 months ago

This also appears to be the case in standard MacOS printing:

image

The printer is just a normal US letter laserjet. Is there a way for me to tell CUPS the correct paper type? I am guessing this is not actually an issue with the Docker image...

zacs commented 3 months ago

Hmm, inside the container's /etc/cups/ PPD file everything appears to be right. I wonder if this is just a MacOS issue?

*DefaultPageSize: Letter
*PageSize A4/A4: "<</PageSize[595 842]/ImagingBBox null>>setpagedevice"
*PageSize A5/A5: "<</PageSize[420 595]/ImagingBBox null>>setpagedevice"
*PageSize A6/A6: "<</PageSize[297 420]/ImagingBBox null>>setpagedevice"
*PageSize B5/JIS B5: "<</PageSize[516 729]/ImagingBBox null>>setpagedevice"
*PageSize B6/JIS B6: "<</PageSize[363 516]/ImagingBBox null>>setpagedevice"
*PageSize EnvC5/Envelope C5: "<</PageSize[459 649]/ImagingBBox null>>setpagedevice"
*PageSize EnvMonarch/Envelope Monarch: "<</PageSize[279 540]/ImagingBBox null>>setpagedevice"
*PageSize EnvDL/Envelope DL: "<</PageSize[312 624]/ImagingBBox null>>setpagedevice"
*PageSize Executive/Executive: "<</PageSize[522 756]/ImagingBBox null>>setpagedevice"
*PageSize Legal/US Legal: "<</PageSize[612 1008]/ImagingBBox null>>setpagedevice"
*PageSize Letter/US Letter: "<</PageSize[612 792]/ImagingBBox null>>setpagedevice"
*CloseUI: *PageSize
*OpenUI *PageRegion/Media Size: PickOne
*OrderDependency: 10 AnySetup *PageRegion
*DefaultPageRegion: Letter
*PageRegion A4/A4: "<</PageSize[595 842]/ImagingBBox null>>setpagedevice"
*PageRegion A5/A5: "<</PageSize[420 595]/ImagingBBox null>>setpagedevice"
*PageRegion A6/A6: "<</PageSize[297 420]/ImagingBBox null>>setpagedevice"
*PageRegion B5/JIS B5: "<</PageSize[516 729]/ImagingBBox null>>setpagedevice"
*PageRegion B6/JIS B6: "<</PageSize[363 516]/ImagingBBox null>>setpagedevice"
*PageRegion EnvC5/Envelope C5: "<</PageSize[459 649]/ImagingBBox null>>setpagedevice"
*PageRegion EnvMonarch/Envelope Monarch: "<</PageSize[279 540]/ImagingBBox null>>setpagedevice"
*PageRegion EnvDL/Envelope DL: "<</PageSize[312 624]/ImagingBBox null>>setpagedevice"
*PageRegion Executive/Executive: "<</PageSize[522 756]/ImagingBBox null>>setpagedevice"
*PageRegion Legal/US Legal: "<</PageSize[612 1008]/ImagingBBox null>>setpagedevice"
*PageRegion Letter/US Letter: "<</PageSize[612 792]/ImagingBBox null>>setpagedevice"
*CloseUI: *PageRegion
*DefaultImageableArea: Letter
*ImageableArea A4/A4: "8 8 587 826"
*ImageableArea A5/A5: "8 8 412 579"
*ImageableArea A6/A6: "8 8 289 404"
*ImageableArea B5/JIS B5: "8 8 508 713"
*ImageableArea B6/JIS B6: "8 8 355 500"
*ImageableArea EnvC5/Envelope C5: "8 8 451 633"
*ImageableArea EnvMonarch/Envelope Monarch: "8 8 271 524"
*ImageableArea EnvDL/Envelope DL: "8 8 304 608"
*ImageableArea Executive/Executive: "8 8 514 740"
*ImageableArea Legal/US Legal: "8 8 604 992"
*ImageableArea Letter/US Letter: "8 8 604 776"
*DefaultPaperDimension: Letter
*PaperDimension A4/A4: "595 842"
*PaperDimension A5/A5: "420 595"
*PaperDimension A6/A6: "297 420"
*PaperDimension B5/JIS B5: "516 729"
*PaperDimension B6/JIS B6: "363 516"
*PaperDimension EnvC5/Envelope C5: "459 649"
*PaperDimension EnvMonarch/Envelope Monarch: "279 540"
*PaperDimension EnvDL/Envelope DL: "312 624"
*PaperDimension Executive/Executive: "522 756"
*PaperDimension Legal/US Legal: "612 1008"
*PaperDimension Letter/US Letter: "612 792"
nateanth commented 2 months ago

I'm having the same issue with my Brother Laser printer only offering 4 letter sizes on IOS, and none of them are Letter size.

chuckcharlie commented 2 months ago

Sorry, I haven't had time to look at this. I will try to troubleshoot this weekend. I did confirm I have the same issue though. I just realized I have been using A4 the whole time and never noticed.

zacs commented 2 months ago

In the past I couldn't even print (it just silently failed) some docs. I thought it was because of this weirdness, but was wrong

The actual problem is that the brlaser package in apt and apk is old. I ended up having to compile the latest from source inside the container. I know the fix and could open a PR to build brlaser from source, but wasn't sure if that would be welcome, given it is a little heavy-handed and most folks aren't using Brother USB printers. If interested, I can submit though!

thomasjpr commented 2 months ago

Seeing this same issue when printing on macOS/iOS/iPad OS to an HP LaserJet 4015.

FiZiX commented 2 months ago

I'm also seeing this issue with a Ricoh SP C250DN

FiZiX commented 2 months ago

Submitted pull request: https://github.com/chuckcharlie/cups-avahi-airprint/pull/33