Overview Example: # status -flag # if no status, then you cannot use commands that would # require status information to be returned. The driver # will set status to OFF if it cannot read information # from the printer status # allow PJL, PCL, PS - flags # enables PJL, PCL, and PS operations for this printer # the pjl_init, pcl_init, and ps_init initialization will be done as well # pjl pcl ps # PJL initialization sequence pjl_init=[ uel jobstart ustatus sync pagecount=pjl language # These keys have pjl_ prefixed to them when searching for info in the # configuration file # UEL is universal exit language string (flag) # jobstart sends JOB START command # ustatus will send pjl_ustatus values # sync will do synchronization # pagecount will do PJL pagecount # language will allow language selection using PJL # PJL termination sequence pjl_term=[ uel jobend ustatus # PJL USTATUS command string # pjl_ustatus=@PJL USTATUS OFF @PJL USTATUS JOB @PJL USTATUS DEVICE [ hpiiisi ] # The HP IIISi understands only PJL UEL, JOB START, JOB END, and # LANGUAGE commands. We can restrict them by redefining the # strings. We also set the pagecount method to be done using # the PS method. pjl_init=[ uel jobstart pagecount=ps pjl_term=[ uel jobend pjl_only=uel jobstart jobend language # define the ps_pagecount string to be used ps_pagecount=/p{print}def ( %%[ ) p statusdict { pagecount } get 20 str cvs p ( %%] ) p () = flush # configure a PS only printer - Apple* # we suppress all PJL operations except for pagecounting # we then force this to be done using PS [ apple* ] pjl pjl_init=[ pagecount=ps # allow no PJL commands pjl_only=none pcl@ # do not allow any more options for the Apple end # deskjet on parallel port [ dj* ] status=off pjl=@ ps=@ pcl end Configuration File Format A configuration file consists of a default section followed by 0 or more SELECTION sections. Each section defines a set of keys and/or flag values. Empty lines and comments (lines whose first character is #) are ignored. A selection header has the form: [ pattern pattern ... ] Each pattern is matched against the printer name specified by the -Tmodel=printer option, the -Pprinter, or the model=printer option in the default section of the configuration file. The first value found will be used as the model or printer name. Pattern matching is case insensitive and is done using the GLOB conventions, i.e. - * matches 0 or more characters, and [abc-x] will match the lower case characters a-z. For example, [ hp* apple* dj[12] ] will match HPIV, AppleLaserJet, and DJ1. The configuration file is scanned for default values and values from selected sections. The special 'end' key will terminate scanning. Each line is used to set a key value that is used to control filter operation. If there are multiple lines with the same key, then the last line encountered will be used to set the key value. A key value line has the form: Equivalent key key=1 key@ key=0 key#value key=value key=value key=value1 value2 value3 key=[ (key | key@ | key=word)* See below key = value key=value key value ILLEGAL, but treated as key=1 Key names are case insensitive, but key values will retain their case. Keys can only contain letters, digits, and underscores. Spaces can preceed and follow the #, @, and = key-value separators. Keys must start in the first column. Lines with leading white white space are treated as continuation lines of the previous line. Readers who are familiar with the PRINTCAP and TERMCAP formats will note the strong resemblance between the two forms of data specification. The special form key=[ is used when a key represents a set of actions to be performed, each of which is in turn specified by a key. The individual actions are performed in the order specified in the list. Values and Substitutions The main purpose of the configuration file is to specify the allowed operations and the corresponding string values and actions required to be sent to the printer. Values may be specified on multiple lines: pcl_size=\033s\%dS pcl_initstr=\033E \033(s\%{size}S pjl_ustatus=@PJL USTATUSOFF @PJL USTATUS JOB @PJL USTATUS DEVICE However, there is a problem when using these values in a particular context, i.e. - as initialization strings for a printer. When using a multi-line value as a PCL initialization string, all whitespace is first removed from the string; when using the value in other contexts, all whitespace at the start and end of each line is removed. After removing whitespace, escape sequences are then replaced. The standard escape sequences are \t - HT, \r - CR, \n - LF, \f - FF, and \nnn which yeilds the character with the corresponding OCTAL value. Note that using other than exactly 3 octal digits may yield unexpected results. The \%x{key} and \%x[key] sequence is used to request value substitution, as converted by format x. \%d - decimal - convert value to integer number \%o - octal - convert value to octal number \%x - hexadecimal - convert value to hexadecimal number \%f - float - convert value to floating point number \%s - string - no conversion In addition, length and fill prefixes can be used. The maximum length of the representation is 127 characters. The value for conversion is obtained as follows: 1. {key}: the keys and values passed with -Zkey=value,key=value command line option is searched for a value. If the key is found, the corresponding value is used. 2. {key} or [key]: the the keys and values passed with -Tkey=value,key=value command line option is searched for a value. If the key is found, the corresponding value is used. 3. {X} or {X} (single character key) the keys and values passed as single character options are searched for a value. If the command line flag was present, then passed value will be used. If no flag was supplied, the empty string ("") will be used. 4. {key} or [key]: The key lines selected from the configuration file will be searched for a matching key=value entry and the value will be used. 5. {key} or [key]: If no value has been found, the value "0" will be used. Example: ifhp -Tsize=3 -Zsize=6,lines=12 -x32 configuration file: size=1 lines=2 plc_size=\033(s\%d{size]}S # This will result in \033(s6S being used. plc_size=\033(s\%d[size] # This will result in \033(s3S being used. plc_lines=\033(s\%d{lines}L # This will result in \033(s2S being used. plc_x=\033(s\%d{x}X # This will result in \033(s32X being used.