[cups] Query regarding setting up common Interface for print jobs

Narcis Garcia informatica at actiu.net
Wed Aug 9 00:38:27 PDT 2017


El 08/08/17 a les 20:27, Brian Potkin ha escrit:
> On Mon 07 Aug 2017 at 20:59:24 +0200, Narcis Garcia wrote:
> 
>> I suppose this can be made with a filter, writing a simple script that
>> gets the job and sends (lp) to one printer depending on job username or
>> caption.
> 
> The OP wants to discriminate between submitted files based on which
> *application* they came from. In the most general case this is most
> likely not doable. Narrowing it down to particular applications might
> produce a solution.
> 

Job caption might be set differently by application.
This is the data I get with a filter script; hope some field is useful
for your OP purpose:

JobID="$1"	# Example: "773"
JobUsername="$2"	# Example: "user"
JobCaption="$3"	# Example: "My cooking recipes"
JobCopiesNr=$4	# Example: 1
JobOptions="$5"	# Example:
"job-uuid=urn:uuid:548ddfa3-2658-3adc-5371-878ae2b364b9
job-originating-host-name=localhost time-at-creation=1473669154
time-at-processing=1473669154"
Job_Content="$6" # Example: "/var/spool/cups/d00773-001" (usually a PDF
file with only root:root permissions "rw,r,")

# Environment variables example:
# CONTENT_TYPE=application/pdf	# The MIME media type associated with the
submitted job file, for example "application/postscript".
# PRINTER_INFO=My virtual printer
# USER=root	# The user executing the filter, typically "lp" or "root";
consult the cups-files.conf file for the current setting
# CUPS_SERVER=/var/run/cups/cups.sock
# HOME=/var/spool/cups/tmp
# RIP_MAX_CACHE=128m
# TMPDIR=/var/spool/cups/tmp
# CUPS_SERVERROOT=/etc/cups	# The root directory of the server
# CUPS_CACHEDIR=/var/cache/cups	# The directory where semi-persistent
cache files can be found and stored
# PRINTER_STATE_REASONS=none
# CUPS_REQUESTROOT=/var/spool/cups
# PATH=/usr/lib/cups/filter:/usr/bin:/usr/sbin:/bin:/usr/bin	# The
standard execution path for external programs that may be run by the filter
# DEVICE_URI=file:///dev/null
# CUPS_STATEDIR=/var/run/cups
# CUPS_MAX_MESSAGE=2047	# The maximum size of a message sent to stderr,
including any leading prefix and the trailing newline
# LANG=ia.UTF-8	# The default language locale (typically C or en)
# CUPS_SERVERBIN=/usr/lib/cups
# CUPS_FILETYPE=document	# The type of file being printed: "job-sheet"
for a banner page and "document" for a regular print file
# PPD=/etc/cups/ppd/My_printer.ppd	# The full pathname of the PostScript
Printer Description (PPD) file for this printer
# CUPS_FONTPATH=/usr/share/cups/fonts
# IPP_PORT=631
# AUTH_INFO_REQUIRED=none
# PRINTER_LOCATION=My printer location
# CUPS_DOCROOT=/usr/share/cups/doc-root
# SERVER_ADMIN=root at system
# PWD=/
# CHARSET=utf-8	# The default text character set, typically "utf-8".
# PRINTER=My_printer	# The name of the printer
# SOFTWARE=CUPS/1.7.2	# The name and version number of the server
(typically CUPS/major.minor)
# CUPS_DATADIR=/usr/share/cups	# The directory where data files can be found
# FINAL_CONTENT_TYPE=printer/My_printer	# The MIME media type associated
with the output destined for the printer, for example
"application/vnd.cups-postscript".
# CUPS_ENCRYPTION=IfRequested
# CLASS	# (can be unset) When a job is submitted to a printer class,
contains the name of the destination printer class. Otherwise this
environment variable will not be set.
# RIP_CACHE	# (can be unset) The recommended amount of memory to use for
Raster Image Processors (RIPs).
# TZ	# (can be unset) The timezone of the server


More information about the cups mailing list