Bug 65482 (suse50482) - mozilla/firefox/thunderbird default paper size should be adjusted
Summary: mozilla/firefox/thunderbird default paper size should be adjusted
Status: RESOLVED FIXED
Alias: suse50482
Product: SUSE Linux 10.1
Classification: openSUSE
Component: Firefox (show other bugs)
Version: unspecified
Hardware: All Linux
: P5 - None : Enhancement (vote)
Target Milestone: ---
Assignee: E-mail List
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 148707
  Show dependency treegraph
 
Reported: 2005-02-03 21:36 UTC by Bjoern Jacke
Modified: 2006-06-22 07:29 UTC (History)
3 users (show)

See Also:
Found By: Other
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bjoern Jacke 2005-02-03 21:36:36 UTC
when printing with firefox or mozilla there are big problems with PostScript
printers if the paper size is not adjusted to A4. As most people don't know
about this trap it would be nice if the default for print.postscript.paper_size
(like in /opt/MozillaFirefox/lib/defaults/pref) would be adjusted according to
/etc/papersize (via SuSEconfig?).
Comment 1 Kevin Ivory 2005-02-03 21:51:41 UTC
and the same for Thunderbird in
/opt/MozillaThunderbird/lib/defaults/pref
and in Mozilla in
/opt/MozillaThunderbird/lib/defaults/pref
please.
Comment 2 Kevin Ivory 2005-02-03 21:52:39 UTC
the second was supposed to be
/opt/mozilla/lib/defaults/pref
of course.
Comment 3 Wolfgang Rosenauer 2005-02-03 21:54:02 UTC
I don't like SuSEconfig for this.
Johannes, is there any way to get the supported papersize with CUPS?
Comment 4 Bjoern Jacke 2005-02-03 22:31:41 UTC
cups lib could provide you with the paper size of each printer but cups libs
aren't used. it would maybe be possible to set up a filter which does a
papersize fitting but that can never solve the problem that the page layout will
still be wrong. As long as the mozilla apps don't have full cups lib support I
don't see a different way than SuSEconfig.
Comment 5 Johannes Meixner 2005-02-03 22:39:32 UTC
Yes.

The correct way is that CUPS support must be added to the browser.
I.e. the browser must be enhanced to use the CUPS libraries.
Then the browser can ask the CUPS system for the available queues
and it can display the queues to the user and for each queue
it can get the whole PPD file or the available options and possible
choices for each option in the PPD file and it can display this
to the user too.
The user selects the queue and the option choices and then
the browser printing engine can produce a PostScript output
which matches perfectly to the selected queue and options.
(This is what OOo does at the moment and therefore the OOo
printing output depends on the selected queue).

But if you are looking for a script based hack to determine
the default paper size and then hack it into a browser config
file then you can "wget" the PPD file for a known queue
from a known host where a CUPS server runs, see
http://portal.suse.com/sdb/en/2004/05/jsmeix_print-cups-in-a-nutshell.html
"cupsd Web Front-end".
I think such a script becomes terrible complicated if it should work
in any case, e.g. for remote queues or if there is a CUPS "client-only"
setup (no local running cupsd).
But only for the default queue and only for "localhost" it is easy:

wget --quiet -O - \
http://localhost:631/printers/$( lpstat -d | sed -e 's/[^:]*: //' ).ppd \
| grep '^*DefaultPageSize:' | sed -e 's/[^:]*: //'

If you need to do it when the browser package is installed (then
there is no local cupsd running) then all you can do is to ask
the YaST experts where the timezone/country information is stored
and if it is US then set Letter in the browser's config file and
otherwise use A4.

In particular if any attempt to autodetect the paper-size fails,
use A4 as fallback because this makes the majority of users happy.
Comment 6 Wolfgang Rosenauer 2005-02-04 04:38:28 UTC
Mozilla does definitely use the cups libs in the meantime. This could/should be
enhanced. The queues are already taken from the CUPS server. It shouldn't be too
hard to get at least the DefaultPageSize.
(but not for 9.3 timeframe)
Comment 7 Kevin Ivory 2005-02-04 17:24:27 UTC
If it is not in 9.3 timeframe, I would like to emphasize part of
Johannes' comment:
> In particular if any attempt to autodetect the paper-size fails,
> use A4 as fallback because this makes the majority of users happy.

Please make the defaults of the RPM to A4.
Comment 8 Bjoern Jacke 2005-02-04 17:26:35 UTC
bjacke@pell:~> rpm -qR MozillaFirefox|grep cups
bjacke@pell:~>

mozilla the same, so there is no cups support (or it's statically linked in), it
probably uses lpstat, /etc/printcap etc. A dirrerent way, which would in deed be
much better than /etc/papersize is to use the default paper size of the locale.
the locale's paper size can also be found out at runtime. It's still not as good
as finding out from the cups server but this way would also the the best effort
for non-cups setups
Comment 9 Wolfgang Rosenauer 2005-02-04 17:30:31 UTC
Björn, you can trust me that the printer list is fetched from CUPS ;-)
Mozilla does load many libs via dlopen to avoid hard dependencies. The same for
CUPS support. I will check what could be done until 9.3
Comment 10 Stefan Dirsch 2005-02-24 14:35:59 UTC
> > In particular if any attempt to autodetect the paper-size fails,
> > use A4 as fallback because this makes the majority of users happy.
> Please make the defaults of the RPM to A4.

It should default to the paper-size according to LC_PAPER.

In shell syntax:
# LC_PAPER=en_US.UTF-8 locale -k height | grep height=297 &>/dev/null && \
                       echo a4 || echo letter
letter
# LC_PAPER=en_GB.UTF-8 locale -k height | grep height=297 &>/dev/null && \
                       echo a4 || echo letter
a4

Needs to be implemented by using nl_langinfo.
Comment 11 Johannes Meixner 2005-02-24 15:01:08 UTC
First of all it should not default to the paper-size according to LC_PAPER
but to the paper size of the actual CUPS queue
because otherwise it would not print correctly
(assume you are in the US but have a de_DE locale setting).

But if it fails to determine the paper size of the actual CUPS queue
then it could default to the paper-size according to LC_PAPER.
Comment 12 Stefan Dirsch 2005-02-24 15:15:11 UTC
I agree. Only if the detection via CUPS fails, it should default to the
paper-size according to LC_PAPER.
Comment 13 Bjoern Jacke 2005-02-24 15:21:41 UTC
in shell syntax for cups:

lpoptions -l -d printqueuename |grep PageSize |sed "s/.*\*\([^ ]*\).*/\1/"

but should also be implemented using cups lib ;-)
Comment 14 Johannes Meixner 2005-02-24 16:00:56 UTC
Wrong!
Please test before posting commands.
See "man lpoptions" what "-d" does and care about ordering of parameters.

Additionally there should be a test and a fallback if the
queue's page size is not supported by Mozilla:

lpoptions -p $QUEUE -l 2>/dev/null \
| sed -n -e 's/^PageSize.*\*\([^ ]*\).*/\1/p' \
| egrep 'Letter|A4' || echo 'A4'

where "echo 'A4'" should be replaced by a fallback according to LC_PAPER.

Strange:

jsmeix@nelson:~> echo $LC_ALL  
en_GB.iso885915

jsmeix@nelson:~> locale
LANG=en_GB.iso885915
LC_CTYPE="en_GB.iso885915"
LC_NUMERIC="en_GB.iso885915"
LC_TIME="en_GB.iso885915"
LC_COLLATE="en_GB.iso885915"
LC_MONETARY="en_GB.iso885915"
LC_MESSAGES="en_GB.iso885915"
LC_PAPER="en_GB.iso885915"
LC_NAME="en_GB.iso885915"
LC_ADDRESS="en_GB.iso885915"
LC_TELEPHONE="en_GB.iso885915"
LC_MEASUREMENT="en_GB.iso885915"
LC_IDENTIFICATION="en_GB.iso885915"
LC_ALL=en_GB.iso885915

jsmeix@nelson:~> echo $LC_PAPER
jsmeix@nelson:~>

Why does "echo $LC_PAPER" result nothing but "locale" shows it?
Is this correct behaviour or is my setup broken?
Comment 15 Stefan Dirsch 2005-02-24 16:04:01 UTC
LC_PAPER derives the value of LC_ALL. The values you can see in the locale output
with "" are derived values, the others like LANG/LC_ALL in your example are
explicitely set.
Comment 16 Wolfgang Rosenauer 2006-02-10 05:41:06 UTC
Just for completeness. The plan is to get the default paper size from CUPS.
But I don't know when this can be implemented upstream. I know something about mozilla code but nothing about cups code.
Comment 17 Wolfgang Rosenauer 2006-02-10 05:49:51 UTC
there is some work ongoing in
https://bugzilla.mozilla.org/show_bug.cgi?id=324060
Comment 18 Wolfgang Rosenauer 2006-02-10 05:57:00 UTC
It's rather late for 10.1 and we'll have to wait until the patch there is finally reviewed for inclusion. So only if we are very lucky this could make it into 10.1
Comment 19 Johannes Meixner 2006-02-10 09:41:13 UTC
If I understand the initial comment in bug #148707 correctly
then Mozilla uses Letter as default/fallback.
But see the 4. and 5. comment in bug #148707:
Why isn't it possible as a quick hack now for 10.1
to simply replace "Letter" with "A4" in the source or in defaults/pref
to have a good default for most (i.e. all except US) of the users? 
Comment 20 Wolfgang Rosenauer 2006-04-19 17:49:48 UTC
OK, I know it's most likely too late to get it in for 10.1 but we will evaluate it for SLE10. (At least for Firefox)
I have an internal test package ready which seems to work correctly for me. We have to do some further tests before we can try to push it in so late in the cycle.
Comment 21 Wolfgang Rosenauer 2006-04-24 15:00:54 UTC
fix submitted for Firefox 10.1rc3.
SeaMonkey and Thunderbird don't use it yet.
Comment 22 Wolfgang Rosenauer 2006-06-21 17:30:07 UTC
fixed almost everywhere