Specialised handling of text files

russell-cups at stuart.id.au russell-cups at stuart.id.au
Mon Aug 2 01:49:35 PDT 2004


I am trying to move from LPRng to CUPS.  All the sites I
administer like their text files printer in a certain way
(some like portrait, some want landscape, etc).  Most
files printed are text, but the remainder are raw, with
a few pdf and postscript files thrown in.  The default
CUPS handling for these remaining files seems to be fine.

I have written a few small programs that translate text
files to appropriately formatted PCL, postscript, or
ESC/2P files.  These programs have been working well for
some years with LPRng.

In my attempts to translate this setup into CUPS I have
assumed that whatever the "right way" is, it would not
modify the config files shipped with CUPS, and I would
not have to hack any PPD files.  In other words - once I
found a PPD that worked I would not have to alter it.

At first I thought I could just add:
  /etc/cups/text.types
  /etc/cups/text.convs
files that did the trick.  text.type would define new
types such as vnd.me-pcl, vnd.me-ps, and so on.  I could
then app lines like this into text.convs:

  text/plain application/vnd.me-pcl 0 /dir/text2pcl.sh
  text/plain application/vnd.me-ps 0 /dir/text2ps.sh
  :

That left the minor issue of getting the output to the
printer.  After a cursory look at the source, I thought
this would work:

  application/vnd.me-pcl printer/aPclPrinter 0 -
  application/vnd.me-ps printer/aPsPrinter 0 -

It didn't work, of course, because it turns out the
printer/XXX mime type isn't created until the PPD
lines are read, and that doesn't happen until after
when the .convs files are read.

It wasn't an ideal solution anyway, as it required me
to manually update the above .convs file every time I
modified my printer via the web interface.

At the moment, the only way out I can see is to hack
the .PPD files that come with CUPS, added a line to
each like:
  *cupsFilter: application/vnd.me-pcl

I was trying to avoid this, as it means my PPD files
won't be updated automatically by up-stream releases.

Any suggestions?

>From my point of view, the idea fix would be to change
the filters the printer adds.  At the moment it adds
a filter for each "*cupsFilter" line, like:
  cupsFilterLine  printer/printerName 0 -

If it could also add one like:
  ppd/ppdFileName printer/printerName 0 -
that would solve all my problems (assuming the
ppd/ppdFileName mime types got added early enough).
I would then just create .convs lines like the one
below for each PPD file I am likely to use (each site
only uses a few), and it should all just work from
then on - regardless of how many printers I add and
delete.
  application/vnd.me-pcl ppd/laserjet.ppd 0 -


--
Regards
Russell Stuart




More information about the cups mailing list