Cups Filter for 2up or 4 up

Georg Z webtraveller at gmx.net
Sun Aug 10 23:24:57 PDT 2008


Hello List,

I am running a cups server, which serves 2 floor of a Department with the required printers and some people like to have special features autoenabled by the printer.

* 2up or 4up

Of course, I could put this option in the lpoption file, however the server didn't send this option. This could be overridden, if I place an lpoption on each server, however this is overridden for instance by firefox automatically.

I thought it would be the best to make an Bash-Filter (Code attached), which would do this work for me. The current problem is that the filter works perfectly if the is executed in the bash environment and it works sometime if it is executed by cups and sometime not !!

#### Filter

#!/bin/bash

# 29.07.2008

# CUPS filter to process 2-up using
# Filter is User and Printer specified
# Create a sandbox for working if input on stdin

#
# job id, user, job title, number of copies, and job options.

if [ $# -lt 6  ]; then
    cat - > "/tmp/$2-`date +'%H:%M:%S'`"
else
    cat $6 > "/tmp/$2-`date +'%H:%M:%S'`"
fi

FN="$2-`date +'%H:%M:%S'`"
cd /tmp

if [ "$2" != "" ]; then
    cat "/tmp/$FN" | /usr/bin/psnup -n 2 > "/tmp/$FN-FIN"
    cat "/tmp/$FN-FIN"
else
    cat "/tmp/$FN"
    fi

rm -f "/tmp/$FN" "/tmp/$FN-FIN"

### Modified PPD-File
[...]
*cupsFilter:    "application/vnd.cups-postscript 0 ps2upps"
[...]

Thanks you very much in advance,

Georg Z.








More information about the cups mailing list