Red Hat Bugzilla – Bug 73067
CUPS printer support
Last modified: 2007-04-18 12:46:11 EDT
I have a C++ program that will generate psprint.conf based on current printer
setting in CUPS. It will be attached here; please feel free to include it in
Of course, OOo should do something like this internally, rather that having all
this psprint stuff in the first place. I have also submitted a version of the
program to OpenOffice.org, but not received a lot of feedback.
Created attachment 73938 [details]
CUPS-to-psprint; an alternative to spadmin etc.
Bero/Tim, can you please check this out?
ATM I'm generating psprint.conf when user first time starts /usr/bin/ooffice,
but just use the defaults and lpr as command. It would be certainly possible
to run a program like this at that time if CUPS is configured and modify
the default psprint.conf, can one of you send me a sample psprint.conf it
generates when CUPS is configured (I don't use CUPS at all)?
(Neither do I, yet.)
It will be weird if OOo automatically groks CUPS printers but not LPRng ones,
since LPRng is still the default spooler for this release.
Created attachment 73965 [details]
Example psprint.conf (generated)
Example of generated file has been attached. Corresponding 'lpstat' output is
Surely, it is quite simple to do the same thing for LPRng. I woudn't really know
, though, as I've never used it; I started replacing lpr on our Red Hat
installations with CUPS when we were on release 5.2 or so.
% lpstat -t
scheduler is running
system default destination: magritte
device for dali: lpd://dali/dali
device for fax: fax://ioserv/fax
device for magritte: ipp://magritte:631/ipp
device for pdf: pdf:~/printout.pdf
dali accepting requests since Jan 01 00:00
fax accepting requests since Jan 01 00:00
magritte accepting requests since Jan 01 00:00
pdf accepting requests since Jan 01 00:00
printer dali is idle. enabled since Jan 01 00:00
printer fax is idle. enabled since Jan 01 00:00
printer magritte is idle. enabled since Jan 01 00:00
printer pdf is idle. enabled since Jan 01 00:00
So basically all you query are the printer queue names, model name and which
one is the default. Tim, how can this be queried for LPRng (ideally from shell
LPRng's 'lpstat -s' gives output like this:
scheduler is running
system default destination: stylus
system for stylus: localhost
system for deskjet: localhost
system for stylus-hi: localhost
system for deskjet-duplex: localhost
system for stylus-raw: localhost
system for deskjet-raw: localhost
All that's missing is the model name, and I guess 'generic postscript' would
Actually, the program copies the PPD file too, if available.
Is lpdomatic for this or how can it be queried?
LPRng doesn't use PPD files.
The kind of information you need is in the output of printconf-tui --Xexport,
but you need to be root for that (for good reason).
Actually, this only makes sense if you can find a PPD file specific to the
printer. "Generic" entries for the configured printers are added automatically,
at least when CUPS is being used.
I'm running the program as root, by the way, actually I've a "run-parts" job for
it to make sure everything stays consistent. Output is to <OO install
dir>/share/psprint/psprint.conf. We are using a slightly different wrapper that
will _remove_ files like psprint.conf from the user's setup, and configure
everything so that the "global" versions are used instead. The only sensible
way, IMO. I'd prefer switching to the Red Hat version of OOo, though, as I'm not
really interested in maintaining packages of my own.
Created attachment 94408 [details]
Here is a new version of the psprint.conf generator. It still updates shared
psprint.conf, and I start it from run-parts in order to keep printers in sync.
I've been wondering if I should modify it to create *user* psprint.conf after
all, though, and execute it (from the wrapper) on every OOo startup. That would
increase startup time a bit, though. (But maybe it would be possible to check
if CUPS printers have changed since last time, and issue the program if, and
only if, they have.)
The wrapper might perhaps to
if [ ! -r psprint.conf -o /etc/cups/printers.conf -nt psprint.conf ]
with openoffice-cups modified to write config to "psprint.conf" on current
directory, and store PPD in "driver" (relative to current dir.)
Current OOO >= 1.1.0-20 use CUPS to discover printers.