Gentoo Wiki


This article is still a Stub. You can help Gentoo-Wiki by expanding it.


Xprint and Mozilla, Mozilla Firefox

Under Mozilla, you can print your document using two different ways, using two different systems. The first is Mozilla's Postscript print driver, and the second the Xprint driver. The Postscript driver is limited for many reasons which will be mentioned in the next section


The most compelling reason to use Xprint over the Postscript driver is the support for embedded TrueType fonts. Mozilla's Postscript driver does not embed TrueType fonts, so your printouts do not even scarcely look like the screen printout. This also creates a problem when you are printing documents that have Chinese/Japanese/Korean, or other non-Latin languages because unless you install the Postscript fonts (not TrueType fonts) for Ghostscript to support these languages, they will appear as square boxes that are, by any standard, unintelligible. Even so, it does not look like the screen output, because the fonts used are different.

However the downside of Xprint is that it is fairly obscure. You might not have heard of it before you came here. It took a poor Asian fellow who wanted to print a Chinese web page from Linux but got an unintelligible printout to do Google search and write this documentation. Anyway, Xprint is basically NOT used by any other major program other than Mozilla. OpenOffice uses its own printing system, so does KDE. GNOME applications use GNOME's system. Mozilla, although a GTK+ application, does not use GNOME's system because its rendering (and thus printing) system has always been independent from the toolkit used. Opera prints beautifully without any external application's help. So probably the only reason you want Xprint is because you like Mozilla Firefox but cannot stand its lousy output.



You need to prepare a few things first.

  1. Xprint-enabled xorg-x11
  2. Cups installation (Xprint uses cups automatically)


Assuming you already have Xorg-x11, ensure that Xprint has been installed (which should not be the case unless you knew of Xprint earlier)

Code: Check useflags for x11-base/xorg-x11
# emerge -Opv xorg-x11

These are the packages that I would merge, in order:

Calculating dependencies ...done!
[ebuild   R   ] x11-base/xorg-x11-6.8.2-r4  <snip> -xprint +xv 0 kB

Since xprint is not among my use flags, I need to add it in to my make.conf. Following which, re-emerge firefox/mozilla.

Code: Edit USE flags and check again
# emacs make.conf
# emerge -Opv xorg-x11

These are the packages that I would merge, in order:

Calculating dependencies ...done!
[ebuild   R   ] x11-base/xorg-x11-6.8.2-r4  <snip> +xprint* +xv 0 kB
# emerge xorg-x11 mozilla-firefox

These are huge and slow packages, so take the time to do something productive.

Post-installation configuration

Firefox needs two things done before it can utilize Xprint.

  1. An appropriate environment variable.
  2. A running Xprint server.

The following steps will accomplish them:

Code: Post-installation
# echo "XPSERVERLIST=':33'" > /etc/env.d/10xprint
# env-update
# /etc/init.d/xprint start
# rc-update add xprint default

Note: Somehow, the default Xprint scripts use port number 33, so that's what you use.

Code: To test
$ . /etc/profile
$ firefox

Then go File->Print. You should see your Xprint printer in the drop-down list.

The Xprint Infrastructure vs Cairo

The Xprint structure is similar to the X-Windowing infrastructure -- it draws on a screen, except this time the screen is a Postscript document that will be passed on to your Printer. For more information, see the Xorg. Xprint is cumbersome because it relies on a very opaque client-server model. However Cairo is emerging as a viable alternative. Similar to drawing on an X canvas using X drawing methods, Cairo draws on its own canvas using PDF functions. Cairo has built-in support for printing too! Moreover, it is a transparent model such that then user does not have to load a server by hand or using init scripts. However, it is still unsupported as of November 2005. Until Mozilla uses Cairo for both its rendering and printing, Linux users will have to make do (as we have always been doing), or use another browser.

Retrieved from ""

Last modified: Mon, 08 Sep 2008 07:09:00 +0000 Hits: 6,242