Using System V interface scripts with CUPS

Solution Unverified - Updated -

Environment

  • Red Hat Enterprise Linux (RHEL) 4, 5, 6, and 7
  • Common Unix Printing System (CUPS)

Issue

  • How can we send all data (whatever MIME type) though a common filter?
  • System V interface scripts are scripts that the print service uses to manage the printer each time it prints a file.
  • We use a customized "SYSV Printer model" in SCO and I wanted to know a few things about using this model in Red Hat Enterprise Linux: 1) Where do I place this printer model file on Red Hat Enterprise Linux? 2) What is the "lpadmin" command line argument to use this printer model?
  • How can we send all data (whatever MIME type) though a common filter? In our industrial print application we need to force the data to be sent though a filter first even if it is not identified as a known mime type.

Resolution

Please note that interface scripts are no longer supported in CUPS 2.2.6 in RHEL 8, as explained in the following Knowledgebase Solution:

Printing Interface Scripts No Longer Supported in RHEL 8

CUPS can use System V interface scripts (sometimes called "printer model files" to replace the normal filter chain that CUPS uses to convert files for printing (more information about this process can be found in the Knowledgebase Solution How does CUPS process files for printing in RHEL ).

The interface scripts can be stored in any directory. CUPS will copy the file to /etc/cups/interfaces when it installs the interface script.

The lpadmin command to install in interface script looks like:

lpadmin -p print-queue-name -i /path/to/interface/script -v socket://ip.addr.of.printer/ -E

where print-queue-name is the name of the print queue on which you want to use the interface script, /path/to/interface/script is the path to the interface script you want to use, and ip.addr.of.printer is the IP address of your printing device. The -E option enables the print queue.

For example, if we want to add a simple form feed to jobs sent to the rawqueue print queue:

  1. First we would create the interface script with the following contents:

    #!/bin/bash 
    shift;shift;shift;shift;shift 
    cat $* 
    echo -e "\f\c"
    
  2. Now we need to add that script to our rawqueue printer

    lpadmin -p rawqueue -E -i formfeed -v parallel:/dev/lp
    

CUPS will copy this script to /etc/cups/interfaces, which we can verify with the following command:

    # ls /etc/cups/interfaces/
    rawqueue

Interface scripts use the same conventions as CUPS filters. More information about writing custom CUPS filters can be found in the following Knowledgebase Solution:

How to create a custom back end or filter for CUPS

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments