Printing from Mozilla 

%%BeginSetup
/pWd 595.2 d /pHt 841.68 d

Ref, A4 %%BoundingBox: 0 0 596 842

Change paper size in printer properties. Now:

/pWd 612 d /pHt 792 d

Ref, Letter BoundingBox: 0 0 612 792

Xprint usage in Mozilla 

http://www.mozilla.org/projects/xprint/usage/

  1. Optional: Start Xprint server ("Xprt") if there is none running yet:

  2. Optional: Make sure $XPSERVERLIST env var is correctly set:

  3. Start Mozilla and load the page you want to print!

  4. Open the print dialog (Menu File/Print…) and select the printer you want to use:

    Notes:
        * Example above shows printers from three diffent sources:
          Two Xprint servers (castor:18 and sepia0:5 and one PostScript module printer ("PostScript/default") at the bottom of the list.
        * The default printer for this user is always being moved at the top of the list.
          This can be changed by setting the $PDPRINTER, $LPDEST and/or $PRINTER env vars (they are searched in that order).
        * Printers which start with PostScript/ are no Xprint-based printers. That are printers from the old PostScript module.
          Xprint-based printers always have an '@'-sign in the middle of the name.
        * If no Xprint-based printers show-up then check...
              o ... if $XPSERVERLIST is set
              o ... if the Xprint server(s) referenced by $XPSERVERLIST are running and accessible (remote Xprt may usually be access-restricted)
              o Consult the FAQ!
  5. Optional: Open the print properties dialog (click on the Properties…-button) and select the job attributes (paper size, color space etc) you want to use…

    Notes:
        * The properties dialog will only offer paper sizes for Xprint-based printers, e.g. you can't print using a paper size which is not supported/allowed for this printer.
        * Do not worry that there may be a lack of paper sizes (only the example above shows that a restriction is possible; the default configuration ("PSdefault") comes with many many paper sizes and you can configure as many paper sizes as you want, too.
        * Setting the spooler command in the dialog is not supported by the Xprint module (the "Print Command:" input widget is disabled for Xprint-module-based printers)
          Remember that the default spooler command is heavily platform-specific and therefore the server side configuration is responsible to define this.
          You can setup the spooler command in the model-config or override it in $XPCONFIGDIR/C/print/attributes/printer either for all printers, per-printer or per-model etc.)).
          Alternatively you can simply print to file...
  6. Print! (e.g. hit the "Print…"-button)

  7. Enjoy the results :-)

    Notes:
        * Watch the sample output gallery...
        * If you have problems read the Notes/Comments in this page and/or consult the FAQ!

documented on: 2004.07.10

A trick to make xprint work much better in Mozilla on Debian 

Newsgroups:  gmane.linux.debian.user
Date:        Sun, 15 Aug 2004 17:29:59 +0200

The problem with xprint (on Debian) seems to be that it cannot always find its fonts. If a web page says explicitly which fonts it wants to use, xprint works OK; but if it doesn't, you get the weirdest results, especially after doing anything with (or even just looking at) the Preferences, Appearance, Fonts menu in Mozilla.

This is a trick to improve printing in Mozilla/xprint: go to the Mozilla "chrome" directory (this is somewhere deep inside inside /.mozilla/default). There is a file called userContent-example.css. Rename this to userContent.css, and edit it, adding at the end:

@media print {
          body {
              color: black;
              font-family: 'Times New Roman', times, serif;
              font-size: 12pt;
          }
          tt, pre {
              font-family: 'Courier New', courier, typewriter, monospace;
          }
          :link, :visited {
              color: black !important;
              text-decoration: underline !important;
          }
}

This tells xprint/Mozilla that in the absence of explicit orders from a website, something like Times New Roman should be used as the default font, and something like Courier New for the monospaced font. It sets the default print size at 12 points, and specifies that links should be printed in black (instead of the default blue, which often looks rather anemic on black and white printers). With this, for the first time in ages, I could print the Debian home page (http://www.debian.org/) correctly. And now I can change Moz's font preferences without messing up printing.

Jan Willem Stumpel

Using The X Print Service 

Mainly from /usr/share/doc/xprt-xprintorg/README.Debian

Using The X Print Service 

As of version 0.0.8, Xprint supports TrueType fonts.

The Xprint server is started and stopped via /etc/init.d/xprint.

/etc/init.d/xprint restart

To Start Xprint servers ("Xprt") at boot time, and shutdown Xprint servers when the machine is being shut down:

% update-rc.d xprint defaults 61
   /etc/rc0.d/K61xprint -> ../init.d/xprint
   /etc/rc1.d/K61xprint -> ../init.d/xprint
   /etc/rc6.d/K61xprint -> ../init.d/xprint
   /etc/rc2.d/S61xprint -> ../init.d/xprint
   /etc/rc3.d/S61xprint -> ../init.d/xprint
   /etc/rc4.d/S61xprint -> ../init.d/xprint
   /etc/rc5.d/S61xprint -> ../init.d/xprint

NB, 61 is from its chkconfig default.

% update-rc.d xprint defaults
 Adding system startup for /etc/init.d/xprint ...
   /etc/rc0.d/K20xprint -> ../init.d/xprint
   /etc/rc1.d/K20xprint -> ../init.d/xprint
   /etc/rc6.d/K20xprint -> ../init.d/xprint
   /etc/rc2.d/S20xprint -> ../init.d/xprint
   /etc/rc3.d/S20xprint -> ../init.d/xprint
   /etc/rc4.d/S20xprint -> ../init.d/xprint
   /etc/rc5.d/S20xprint -> ../init.d/xprint

NB, there is no "default" 20 in /etc/init.d/xprint. The 20 must be from
update-rc.d instead.

% update-rc.d -f xprint remove
update-rc.d: /etc/init.d/xprint exists during rc.d purge (continuing)
 Removing any system startup links for /etc/init.d/xprint ...
   /etc/rc0.d/K20xprint
   /etc/rc1.d/K20xprint
   /etc/rc2.d/S20xprint
   /etc/rc3.d/S20xprint
   /etc/rc4.d/S20xprint
   /etc/rc5.d/S20xprint
   /etc/rc6.d/K20xprint

Clients 

Client programs such as mozilla will require the Xprint server to be identified in variable XPSERVERLIST. This variable is automatically defined for all X sessions in /etc/X11/Xsession.d/92xprint-xpserverlist. If required, the value for this variable can be obtained manually using /etc/init.d/xprint, via "/etc/init.d/xprint get_xpserverlist", e.g., export XPSERVERLIST=`/etc/init.d/xprint get_xpserverlist`

  1. /etc/X11/Xsession.d/92xprint-xpserverlist

    $ svs XPSERVERLIST
    XPSERVERLIST=:64

You can test that Xprt is working by running xplsprinters.

$ xplsprinters
printer: hp_psc_1210@:64
printer: xp_ps_spooldir_tmp_Xprintjobs@:64
printer: xp_pdf_spooldir_tmp_Xprintjobs@:64
$ xplsprinters -l -printer "hp_psc_1210@:64"
xplsprinters:  no printers found for printer spec "hp_psc_1210@:64".
$ xplsprinters -l -printer "hp_psc_1210"
printer: hp_psc_1210@:64
        comment=PostScript default model
        model-identifier=PSdefault
        default-medium=na-letter
        default-input-tray=
        medium-source-sizes-supported=na-letter false 6.35 209.55 6.35 273.05
        medium-source-sizes-supported=na-legal false 6.35 209.55 6.35 349.25
        [...]
        default-printer-resolution=300
        resolution=300
        resolution=360
        resolution=400
        resolution=600
        default_orientation=portrait
        orientation=portrait
        orientation=landscape
        orientation=reverse-portrait
        orientation=reverse-landscape
        default_plex=
        plex=simplex
        plex=duplex
        plex=tumble

xphelloworld prints a simple test page.

Print nothing but "hello world from X11 print system", especially no way to specify a border.

Change page size 

original value 
$ grep default-medium /usr/share/Xprint/xserver/C/print/attributes/document
*default-medium: iso-a4
# *default-medium: iso-a4
right value 
# US and some other countries use US-Letter as default paper size
# ("C"-locale default is "ISO-A4")
*default-medium: na-letter

documented on: 2004.07.07

The X Print Service 

/usr/share/doc/xprt-xprintorg/README /usr/share/doc/xprt-xprintorg/README.Debian

Using the X Print Service 

There are three tasks to start the X Print Service: 1) configuring the X Print Server, 2) starting the X Print Service, 3) configuring the user session so that clients can find the running X Print Service.

The tasks are described in detail below.

X Print Server Configuration 

The X Print Server (Xprt) can read a number of configuration files which control its behavior and support for printers. Each vendor platform has a default location for this information. Xprt can also read the environment variable XPCONFIGDIR to locate alternate configuration directories. Common settings include:

Xprt has many built-in defaults, and lacking any configuration files, will immediately try to support all printers visible via lpstat(1).

In order of importance for configuration by a system administrator, the configuration files for a "C" locale are as follows.

${XPCONFIGDIR}/C/print/Xprinters
`Xprinters' is the top most configuration file.  It tells
Xprt which specific printer names (e.g.  mylaser) should
be supported, and whether lpstat(1) or other commands
should be used to automatically supplement the list of
printers.
${XPCONFIGDIR}/C/print/attributes/printer
The `printer' file maps printer names to model
configurations (see `model-config' below).  For example,
"mylaser" could be mapped to a "HPDJ1600C", and all other
arbitrary printers could be mapped to a default, such as
"HPLJ4SI".  When depending on lpstat(1) in the Xprinters
file, setting up defaults in `printer' becomes all the
more important.
${XPCONFIGDIR}/C/print/attributes/document
The `document' file specifies the initial document values
for any print jobs.  For example, which paper tray to
use, what default resolution, etc.
${XPCONFIGDIR}/C/print/attributes/job
The `job' file specifies the initial job values for any
print jobs.  For example, "notification-profile" can be
set so that when a print job is successfully sent to a
printer, e-mail is sent to the user.

X Print Server Default Configuration 

$ fileh f-clean < /usr/share/Xprint/xserver/C/print/Xprinters
Printer xp_pdf_spooldir_tmp_Xprintjobs
Printer xp_ps_spooldir_tmp_Xprintjobs
$ fileh f-clean < /usr/share/Xprint/xserver/C/print/attributes/printer
*xp-model-identifier: PSdefault
xp_ps_spooldir_tmp_Xprintjobs.xp-model-identifier: PSspooldir
xp_pdf_spooldir_tmp_Xprintjobs.xp-model-identifier: PS2PDFspooldir-GS
$ fileh f-clean < /usr/share/Xprint/xserver/C/print/attributes/document
*content-orientation: portrait
*copy-count: 1
*default-medium: iso-a4
*default-printer-resolution: 300
PSspooldir.default-printer-resolution: 300
PS2PDFspooldir-GS.default-printer-resolution: 600
HPLJ4050-PS.default-printer-resolution: 600
$ fileh f-clean < /usr/share/Xprint/xserver/C/print/attributes/job
*notification-profile: {}

Available printers 

Newsgroups:  gmane.linux.debian.user
Date:        Wed, 22 Jun 2005 19:37:00 GMT
> When my wife tries to print from her desktop, the choices of printer are
> * scx5400_5400@:64
> * xp_ps_spooldir_HOME_xprint ... @:64
> * xp_pdf_spooldir_HOME_xprint ...@:64
> * Postscript/scx5300_5400
> And everything she tries to print comes out with very large fonts and
> only about half on the page, as though the dots-per-inch setting is way off.

That system's running xprint, and it just appears that the default resolution configured for xprint is above the available resolution of your printer. You can correct this by editing /etc/Xprint/C/print/attributes/document and setting *default-printer-resolution: 300 (or whatever resoution is appropriate for the printer).

Stephen Patterson