Viewing file: foomatic-addpjloptions (29.16 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
#!/usr/bin/perl
#
# This script adds PJL options, polled from the printer, into the Foomatic
# database. Use "foomatic-getpjloptions" to poll the options, use
# "foomatic-addpjloptions -h" for help.
#
#
# Till Kamppeter (till.kamppeter@gmx.net)
#
# Copyright 2001 Till Kamppeter
#
# This software may be freely redistributed under the terms of the GNU
# General Public License (http://www.gnu.org/).
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
use strict;
use FileHandle;
my $dir = "./foomatic-db/opt";
sub usage(){
print STDERR <]
foomatic-addpjloptions [-dqaf] []
foomatic-addpjloptions -h
-a Include all options
-d enable debugging output
-f Do not ask user whether he really wants to add the
PJL options
-i Include only important options
-s Create a single option file
-q Summary format
-h This help message
-p printer_ID Printer where to add the PJL options
-o option_dir directory for saving option files (default $dir)
File with the PJL options returned by the printer,
if this filename is not provided, the PJL options are
taken from standard input.
EOF
exit(1);
}
# ignore the following entries by default
my $opt = {};
my $debug = 0;
my $exclusions =
{ 'PAPER'=>1, # already handled by GhostScript/PS
'RESOLUTION'=>1, # already handled by GhostScript/PS
'LANG'=>1, # only affects printer display
'PERSONALITY'=>1,# the page description language
# is set by the driver
'PAGECOUNT'=>1, # printer-internal counters,
'LPAGECOUNT'=>1, # no influence on print job
'PAGES'=>1,
'MAINTINTERVAL'=>1,
'FORMLINES'=>1, # only for text printing
'AUTOCRLF'=>1, # but Foomatic prints text as
'AUTOLFCR'=>1, # PostScript
'FONTSOURCE'=>1,
'FONTNUMBER'=>1,
'PITCH'=>1,
'PTSIZE'=>1,
'SYMSET'=>1,
'LFONTPRIORITY'=>1,
'POWERSAVE'=>1, # not a per-job setting
'TIMEOUT'=>1,
'USERNAME'=>1, # String options
'JOBNAME'=>1,
};
# important options
my $longsubs = {
'copies' => 'Number of Copies',
'orientation' => 'Orientation',
'ret' => 'Resolution Enhancement',
'manualfeed' => 'Manual Feed of Paper',
'pageprotect' => 'Page Protection',
'mptray' => 'Multi-Purpose Tray',
'density' => 'Toner Density',
'lowtoner' => 'Behaviour when Toner Low',
'outbin' => 'Output Bin',
'joboffset' => 'Job Offset',
'economode' => 'Toner Saving',
'ecoprint' => 'Toner Saving',
'intray1size' => 'Paper Size in Tray 1',
'intray2size' => 'Paper Size in Tray 2',
'intray3size' => 'Paper Size in Tray 3',
'intray4size' => 'Paper Size in Tray 4',
'intray5size' => 'Paper Size in Tray 5',
'intray6size' => 'Paper Size in Tray 6',
'intray7size' => 'Paper Size in Tray 7',
'intray8size' => 'Paper Size in Tray 8',
'intray9size' => 'Paper Size in Tray 9',
'intray10size' => 'Paper Size in Tray 10',
'widea4' => 'Wide A4',
'bitsperpixel' => 'Bits Per Pixel',
'holdtype' => 'Hold Job Type',
'hold' => 'Hold Job',
'pr1200speed' => 'Speed at 1200 dpi',
'outbinprocess' => 'Output Bin Process',
'finish' => 'Finisher',
'stapleoption' => 'Stapling Mode',
'extendedprintarea' => 'Extended Print Area',
'heldjobtimeout' => 'Timeout for Held Jobs',
'imageadapt' => 'Image Adaptation',
'autocont' => 'Autocont',
'fastraster' => 'Fast Raster',
'intray1' => 'Input Tray 1',
'intray2' => 'Input Tray 2',
'intray3' => 'Input Tray 3',
'intray4' => 'Input Tray 4',
'intray5' => 'Input Tray 5',
'intray6' => 'Input Tray 6',
'intray7' => 'Input Tray 7',
'intray8' => 'Input Tray 8',
'intray9' => 'Input Tray 9',
'intray10' => 'Input Tray 10',
'duplex' => 'Double-Sided Printing',
'binding' => 'Binding',
'holdkey' => 'Key for Held Jobs',
'lparm_postscript_prtpserrs' => 'Print PostScript Errors',
'limageenhance' => 'Image Enhancement',
'limageenhancetype' => 'Image Enhancement Type',
'lblankpages' => 'Blank Pages',
'lcollation' => 'Collation',
'limagerotation' => 'Image Rotation',
'linmpfeedersize' => 'Paper Size in MP Feeder',
'lsubstitutesize' => 'Substitute Paper Size',
'lpicturegrade' => 'Picture Grade',
'ljamrecovery' => 'Jam Recovery',
'lpagemode' => 'Page Mode',
'lmultipageborder' => 'Border for N-up Printing',
'lmultipageorder' => 'Order for N-up Printing',
'lmultipageprint' => 'Pages per Sheet (N-up Printing)',
'lmultipageview' => 'Orientation for N-up Printing',
'lparm_pcl_lbitmaprounding' => 'Bitmap Rounding',
'lparm_pcl_lcolorextensiond' => 'Colour Extensions',
'lseparatorsheets' => 'Separator Sheets',
'lseparatorsource' => 'Take Separator Sheets From',
'econolevel' => 'Toner Saving Level',
'mediatype' => 'Media Type',
'mediasource' => 'Media Source',
'sourcetray' => 'Media Source',
'kintrayselect' => 'Media Source',
'okipaperfeed' => 'Media Source',
'lpapersource' => 'Media Source',
'errorprint' => 'Print Error Messages',
'lcolormodel' => 'Colour Model',
'lcolorcorrection' => 'Colour Correction',
'limagebrightness' => 'Image Brightness',
'limagecontrast' => 'Image Contrast',
'limagesmoothing' => 'Image Smoothing',
'lprintquality' => 'Printout Quality',
'okipapersizecheck' => 'Paper Size Checking'
#'papersize' => 'Media Size',
#'paper' => 'Media Size',
#'lang' => 'Language',
#'resolution' => 'Resolution',
#'personality' => 'Personality',
#'timeout' => 'Timeout',
#'cplock' => 'CP Lock',
#'powersave' => 'Power Saving',
#'powersavetime' => 'Power Saving Timeout',
#'iobuffer' => 'I/O Buffer',
#'iosize' => 'I/O Size',
#'resourcesave' => 'Resource Saving',
#'disklock' => 'Disk Lock',
#'qty' => 'Quantity',
#'courier' => 'Courier',
#'formlines' => 'Form Lines',
#'reprint' => 'Reprint',
#'password' => 'Password',
#'username' => 'User Name',
#'jobname' => 'Job Name',
#'testpage' => 'Test Page',
#'planesinuse' => 'Planes in Use',
#'outlinepointsize' => 'Outline Point Size',
#'maintinterval' => 'Maintenance Interval',
#'finishertype' => 'Finisher Type',
#'finisheroption' => 'Finisher Option',
#'hitransfer' => 'Hi Transfer',
#'parallel' => 'Parallel Port Mode',
#'xoffset' => 'X Offset',
#'yoffset' => 'Y Offset',
#'lpowersaver' => 'Power Saver',
#'ladvancedstatus' => 'Advanced Status',
#'lalarmcontrol' => 'Alarm Control',
#'lcancel' => 'Cancel',
#'lresourcesave' => 'Resource Saving',
#'lleftmarginoffset' => 'Left Margin Offset',
#'ltopmarginoffset' => 'Top Margin Offset',
#'okieurosign' => 'Euro Character',
};
# Read command line options
use Getopt::Std;
# Printer ID, force (no printer ID confirmation)
getopts("p:o:afisqh",$opt) bool(false)
|