Prints on Brother Printer are cut off on top (related to `PageSize=A4` vs. `media=iso_a4` in CUPS debug output)
Categories
(Core :: Printing: Output, defect)
Tracking
()
People
(Reporter: bugzilla, Assigned: emilio)
References
(Regression)
Details
(Keywords: regression)
Attachments
(5 files)
User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:89.0) Gecko/20100101 Firefox/89.0
Steps to reproduce:
Print any webpage or PDF using a Linux system using CUPS with a Brother HL-4150CDN printer. May affect other printer models as well.
Actual results:
The print is not centered on the page and cut off at the top. See the attached picture for an example print out of https://www.chefkoch.de/rezepte/drucken/584141157550682/Kubanische-Reispfanne.html
I used hg bisect to identify the commit, which caused this behaviour. It is https://hg.mozilla.org/integration/autoland/rev/ef18a39a5f21 which was introduced as a fix for this bug: of https://bugzilla.mozilla.org/show_bug.cgi?id=1691798
The left printout is made with commit 635652:6fd8d4c5931c and the right one with commit 635653:ef18a39a5f21, which was the fix for the paper size issue in #1691798.
Expected results:
I expect the print out to be aligned to the page, as it was before the commit 635653.
I also compared the cups debug output of a good and a bad printout:
good.log:D [19/Jun/2021:13:35:09 +0000] [Job 637] argv[5]="PageSize=A4 BRGreen=0 BRSkipBlank=OFF BRImproveOutput=OFF BRMediaType=Plain BRTonerSaveMode=OFF BRMonoColor=Auto BRInputSlot=AutoSelect BRBrightness=0 BRReverse=OFF BRContrast=0 noCollate BREnhanceBlkPrt=OFF BRBlue=0 BRGray=ON BRResolution=600dpi BRDuplex=None BRSaturation=0 number-up=1 BRRed=0 BRColorMatching=Normal job-uuid=urn:uuid:fd176ebe-9ebf-32ca-65d0-2a06f4810042 job-originating-host-name=192.168.188.43 date-time-at-creation= date-time-at-processing= time-at-creation=1624109709 time-at-processing=1624109709"
bad.log:D [19/Jun/2021:13:37:00 +0000] [Job 638] argv[5]="BRGreen=0 BRSkipBlank=OFF BRImproveOutput=OFF BRMediaType=Plain BRTonerSaveMode=OFF BRMonoColor=Auto BRInputSlot=AutoSelect BRBrightness=0 BRReverse=OFF BRContrast=0 noCollate BREnhanceBlkPrt=OFF BRBlue=0 BRGray=ON media=iso_a4 BRResolution=600dpi BRDuplex=None BRSaturation=0 number-up=1 BRRed=0 BRColorMatching=Normal job-uuid=urn:uuid:f1ba805f-b30e-39da-7bd6-adc29c6b2d8d job-originating-host-name=192.168.188.43 date-time-at-creation= date-time-at-processing= time-at-creation=1624109820 time-at-processing=1624109820"
The only relevant change I was able to spot is the change from "PageSize=A4" to "media=iso_a4".
Comment 4•3 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::Printing: Output' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.
What I do not understand is where 'iso_a4' comes from. It's not part of the list of supported PageSize/Media Size values listed by lpoptions:
# lpoptions -p HL-4150CDN -l | grep PageSize
PageSize/Media Size: A4 *Letter Legal Executive A5 A5Rotated A6 B5 B6 EnvDL EnvC5 Env10 EnvMonarch Br3x5 FanFoldGermanLegal EnvPRC5Rotated Postcard EnvYou4 EnvChou3
Note: This is a shared printer and the above output was generated on the print server. Firefox is running on a client, which talks to this print server over IPP.
@emilio maybe you have some input on how to further debug this regression of your change?
Assignee | ||
Comment 6•3 years ago
|
||
iso_a4
is this gtk constant.
FWIW, mozregression
could've saved you a bit of bisect time (would've avoided you having to rebuild over and over). media
is an standard CUPS keyword and the driver is supposed to understand it...
Per the discussion in bug 1691798 brother drivers use a perl cupswrapper
that might not be handling stuff correctly?
If you use the system dialog (via the "print via the system dialog" option) does it work then? What is the log like in that case?
Updated•3 years ago
|
When I print from any other program the printouts are fine. I tested evince, gedit, gourmet recipe manager and many other programs. All working as expected.
All these logs look like the good log file I added as an example. Here is an excerpt of a PDF printed with evince:
D [24/Jun/2021:17:38:36 +0000] [Job 649] argv[5]="PageSize=A4 BRGreen=0 BRSkipBlank=OFF BRImproveOutput=OFF BRMediaType=Plain BRTonerSaveMode=OFF BRMonoColor=FullColor BRInputSlot=Tray1 BRBrightness=0 BRContrast=0 BREnhanceBlkPrt=OFF BRReverse=OFF noCollate BRBlue=0 BRGray=ON BRResolution=600dpi BRDuplex=DuplexNoTumble BRSaturation=0 number-up=1 BRRed=0 BRColorMatching=Normal job-uuid=urn:uuid:8c76f57a-8c90-3475-6bac-48cd92265d0b job-originating-host-name=192.168.188.43 date-time-at-creation= date-time-at-processing= time-at-creation=1624556316 time-at-processing=1624556316"
Assignee | ||
Comment 8•3 years ago
|
||
Right, I meant with firefox, but using the Print using the system dialog...
over the cancel / print buttons.
Oh, I always use the system dialog, because the IPP printer does not show up in the Firefox dialog. I have set print.tab_modal.enabled = false
.
Updated•3 years ago
|
Comment 10•3 years ago
|
||
"iso_a4" is also a constant we use as the PWG name for A4 paper. If it's coming from our list of common paper sizes, this may be the same issue as bug 1717295 where localization is failing.
Updated•3 years ago
|
Comment 11•3 years ago
|
||
Hi vollkorn -- sorry this has sat for so long. This came up in a triage pass of our printing bugs -- just checking in, is this still reproducible? (I imagine it probably is, but I want to double-check.)
(In reply to Emilio Cobos Γlvarez (:emilio) from comment #6)
Per the discussion in bug 1691798 brother drivers use a perl
cupswrapper
that might not be handling stuff correctly?
Incidentally: the Brother print-driver download page for the reporter's printer, https://support.brother.com/g/b/downloadlist.aspx?c=us&lang=en&prod=hl4150cdn_all&os=128 , has a download called CUPS wrapper Printer driver Source Codes
, which (like the .deb packages files) is dated 09/13/2010
(i.e. over 11 years ago)
I did a case-insensitive grep for a4
inside the contents of that download, and I ran across the following lines in file brcupsconfig/brcups_commands.h
:
CMDLINELIST commandlinelist[] = {
[...]
// Paper
{ "PageSize=A4", "-pt A4" },
[...]
// for Command Line
{ "media=A4", "-pt A4" },
Note the "PageSize=A4"
there (the old/working string quoted in comment 1) as well as "media=A4"
(nearly but not quite matching the "media=iso_a4"
new & not-working string quoted in comment 1). There was no mention of iso_a4
(or iso_
at all) anywhere in this download.
I don't really know CUPS stuff, but I wonder if this apparently-ancient CUPS wrapper Printer driver Source Codes
should theoretically be recognizing iso_a4
but just doesn't?
Reporter | ||
Comment 12•3 years ago
|
||
Hi Daniel,
yes, the printouts are still cut off at the top. I don't know much about CUPS either, but I'm using this printer since eight years with Linux. The last five years behind a CUPS server also serving a Windows client. No program other than Firefox on Linux ever had that problem. And I print quite regularly from a few different applications.
I think Firefox using media=iso_a4
is an outlier. All the other print mechanisms send PageSize=A4
. Windows, Gnome, Libreoffice, whatever else a typical Ubuntu installation has for printing.
Comment 13•3 years ago
|
||
Jonathan, this seems to only affect relatively few people, could you reassess the severity?
Reporter | ||
Comment 14•3 years ago
|
||
With FF97 or 98 I was able to make it work properly by setting the paper size properly in the modal print dialog and in the system print dialog afterwards. But this doesn't work anymore in FF99.
But, seriously, this was working fine with different machines, different Ubuntu versions and this one printer model for over eight years and with the introduction of the modal print dialog printing got botched so badly for me, that since I cannot disable the modal print dialog anymore I'm thinking about fully switching to Chromium, not just for printing. Please, I understand you have more pressing issues, so downgrade the severity. Nothing happened in the last 10 months anyway and it's likely to just be a forever dangling bug with a single affected user. That's what you tried to say in a diplomatic way, Marco, isn't it?
I use and love FF since it was called Netscape, but maybe I just became LongTimeUser4 in this joke: https://xkcd.com/1172/
Updated•2 years ago
|
Assignee | ||
Comment 16•2 years ago
|
||
Try to find a PPD paper size from our IPP paper size to workaround print
driver bugs.
Before:
Apr 25 18:43:47 ryzen cupsd[850753]: cupsdProcessIPPRequest: media keyword 'iso_a4_210x297mm'
After:
Apr 25 19:22:54 ryzen cupsd[850753]: cupsdProcessIPPRequest: PageSize nameWithoutLanguage 'A4'
Updated•2 years ago
|
Assignee | ||
Comment 17•2 years ago
|
||
Any chance you can go to:
https://treeherder.mozilla.org/jobs?repo=try&revision=7381c53e2f68946769459ee038eee9540bda0b73
Click on the "B" once it's green, go to the "Artifacts and Debugging Tools" tab, and download the target.tar.bz2
file, which contains a build with the patch, and confirm it fixes the issue with your printer?
Comment 18•2 years ago
|
||
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/69c12cde10a3 Prefer ppd to ipp to custom names in GTK code. r=AlaskanEmily
Comment 19•2 years ago
|
||
bugherder |
Comment 20•2 years ago
|
||
(In reply to Emilio Cobos Γlvarez (:emilio) from comment #17)
Any chance you can go to:
https://treeherder.mozilla.org/jobs?repo=try&revision=7381c53e2f68946769459ee038eee9540bda0b73
Click on the "B" once it's green, go to the "Artifacts and Debugging Tools" tab, and download the
target.tar.bz2
file, which contains a build with the patch, and confirm it fixes the issue with your printer?
This fix is now in Nightly builds, so rather than downloading a build from Treeherder to test, you can just grab the latest Nightly instead:
https://www.mozilla.org/firefox/channel/desktop/
Reporter | ||
Comment 21•2 years ago
|
||
Hi Emilio,
sorry for the long waiting time, I was traveling. I downloaded the fix from treeherder and tested it in the following way:
- Execute 'firefox' binary
- Open random webpage
- Hit Ctrl+P
- Select "Print from system dialog" because the modal print dialog does not see my IPP-connected printer.
- Select my printer in the system print dialog
The printout is still cut off at the top.
This is the cups error log is pretty much unchanged as well (media=iso_a4):
D [02/May/2022:06:13:46 +0000] [Job 1139] argv[5]="BRGreen=0 BRSkipBlank=OFF BRImproveOutput=OFF BRMediaType=Plain BRTonerSaveMode=OFF BRMonoColor=Auto BRInputSlot=AutoSelect BRBrightness=0 BRReverse=OFF BRContrast=0 noCollate BREnhanceBlkPrt=OFF BRBlue=0 BRGray=ON media=iso_a4 BRResolution=600dpi BRDuplex=None BRSaturation=0 number-up=1 BRRed=0 BRColorMatching=Normal job-uuid=urn:uuid:e5c36e57-01b7-3bc0-4ea0-570b088c7fc1 job-originating-host-name=192.168.188.43 date-time-at-creation= date-time-at-processing= time-at-creation=1651472026 time-at-processing=1651472026"
D [02/May/2022:06:13:46 +0000] [Job 1139] Running command line for pstops: pstops 1139 jan \'Chefkoch Rezept: BΓ€rlauch-GrieΓnockerl von ManuGro\' 1 \'BRGreen=0 BRSkipBlank=OFF BRImproveOutput=OFF BRMediaType=Plain BRTonerSaveMode=OFF BRMonoColor=Auto BRInputSlot=AutoSelect BRBrightness=0 BRReverse=OFF BRContrast=0 BREnhanceBlkPrt=OFF BRBlue=0 BRGray=ON media=iso_a4 BRResolution=600dpi BRDuplex=None BRSaturation=0 BRRed=0 BRColorMatching=Normal job-uuid=urn:uuid:e5c36e57-01b7-3bc0-4ea0-570b088c7fc1 job-originating-host-name=192.168.188.43 date-time-at-creation= date-time-at-processing= time-at-creation=1651472026 time-at-processing=1651472026\'
Reporter | ||
Comment 22•2 years ago
|
||
Ah, fiddling around I found a that it starts working after I set the paper size from US to A4 in the modal print dialog. (The paper size in the system print dialog was set to A4 at all times)
So there is two situations:
- Unmodified paper size in modal print dialog -> system print dialog A4 -> cut-off print out
- Switch paper size from US to A4 in modal print dialog -> system print dialog A4 -> print out intact
Cups error log from case 2 shows the paper size is selected correctly:
D [02/May/2022:06:24:32 +0000] [Job 1140] argv[5]="PageSize=A4 BRGreen=0 BRSkipBlank=OFF BRImproveOutput=OFF BRMediaType=Plain BRTonerSaveMode=OFF BRMonoColor=Auto BRInputSlot=AutoSelect BRBrightness=0 BRReverse=OFF BRContrast=0 noCollate BREnhanceBlkPrt=OFF BRBlue=0 BRGray=ON BRResolution=600dpi BRDuplex=None BRSaturation=0 number-up=1 BRRed=0 BRColorMatching=Normal job-uuid=urn:uuid:0c4cd9e6-078a-3568-6854-8c840e8c218b job-originating-host-name=192.168.188.43 date-time-at-creation= date-time-at-processing= time-at-creation=1651472672 time-at-processing=1651472672"
D [02/May/2022:06:24:32 +0000] [Job 1140] Running command line for pstops: pstops 1140 jan 'Chefkoch Rezept: BΓ€rlauch-GrieΓnockerl von ManuGro' 1 'PageSize=A4 BRGreen=0 BRSkipBlank=OFF BRImproveOutput=OFF BRMediaType=Plain BRTonerSaveMode=OFF BRMonoColor=Auto BRInputSlot=AutoSelect BRBrightness=0 BRReverse=OFF BRContrast=0 BREnhanceBlkPrt=OFF BRBlue=0 BRGray=ON BRResolution=600dpi BRDuplex=None BRSaturation=0 BRRed=0 BRColorMatching=Normal job-uuid=urn:uuid:0c4cd9e6-078a-3568-6854-8c840e8c218b job-originating-host-name=192.168.188.43 date-time-at-creation= date-time-at-processing= time-at-creation=1651472672 time-at-processing=1651472672'
Reporter | ||
Comment 23•2 years ago
|
||
I tested with firefox-101.0b6.tar.bz2 and print.prefer_system_dialog
today. It's not working. And I cannot get it to work with any workaround like selecting A4 in the modal print dialog and then disabling it again.
I would like to step through the code and see for my self what's happening. Can anyone let me know:
- Is there any special tooling for building debug versions and stepping through the code in FF?
- Where should I set my first breakpoint to see how the paper size is selected?
Thanks
Assignee | ||
Comment 24•2 years ago
|
||
There's docs in https://firefox-source-docs.mozilla.org/contributing/contribution_quickref.html. I'd probably look at nsDeviceContextSpecGTK::Init
(i.e., the code touched above).
Comment 25•2 years ago
|
||
(In reply to Emilio Cobos Γlvarez (:emilio) from comment #24)
There's docs in https://firefox-source-docs.mozilla.org/contributing/contribution_quickref.html.
Note that by default you'll get an optimized build. To get a debug build, you'll want be sure to include the following in your mozconfig file:
ac_add_options --enable-debug
ac_add_options --disable-optimize
If you need help getting your build set up, a good place to ask for help is:
https://chat.mozilla.org/#/room/#introduction:mozilla.org
And once you're debugging, these are good spots for pointers about the printing code:
https://chat.mozilla.org/#/room/#printing:mozilla.org
https://chat.mozilla.org/#/room/#layout:mozilla.org
Updated•2 years ago
|
Reporter | ||
Comment 26•2 years ago
|
||
I upgraded from Ubuntu 20.04 to Ubuntu 22.04 in the meantime and am using Firefox 106.0.1 right now.
The print command from a Firefox print is still using media=iso_a4
in contrast to any other program using PageSize=A4
.
My printer still does not offer iso_a4
:
# lpoptions -l
PageSize/Media Size: *A4 Letter Legal Executive A5 A5Rotated A6 B5 B6 EnvDL EnvC5 Env10 EnvMonarch Br3x5 FanFoldGermanLegal EnvPRC5Rotated Postcard EnvYou4 EnvChou3
[...]
But something changed. The prints are not cut off on the top anymore. They are still what seems to me Letter-sized, but now they are zoomed out a bit and are having white space on the bottom. I'll add some photos.
I didn't get around to looking at where Firefox does go wrong with selecting the paper/media size with a debugger, yet.
Reporter | ||
Comment 27•2 years ago
|
||
Description
•