1

(How) Is it possible to preprocess lp automatically with a script? Piping inbetween (fileToPrint | script.sh | lp -d myPrinter) is no option for me, because I have a lot of source code that does lp directly (lp -d myPrinter filetoPrint) and there is currently no intention to change this, especially since the script is only needed for one specific printer.

I'm thinking of something like lpoption where I could say (pseduocode) preprocess myPrinter with script.sh (and only for myPrinter, not for myOtherPrinter).

Is this somehow possible?

2

You could write your own backend that runs the preprocessing and then hands it off to whatever actual backend you're normally using. When you set up the printer, you'd using your custom backend in the URI.

I actually have done something similar to allow CUPS to print to a locally-patched LPRng server.

1
  • +1, thanks for interesting the link, I learned something new with it. But I found a solution that works better (easier) for me, so I wrote my answer. – Foo Bar Jun 27 '15 at 8:43
0

I stumbled over tea4cups (in Debian the Package is cups-tea4cups), where one can do exactly what I want, like this:

# tea4cups.conf
[myprinter] # just the cups printer name
filter: mycommand
# pipes everything though mycommand, like "<input> | mycommand | lp"
# if the printer URI is prefixed with 'tea4cups://'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.