# The Master /etc/ifhp.conf File
# Assumes that we are generating output for a HP LaserJet Family Printer
# $Id: ifhp.conf,v 1.1.1.2 1999/05/21 22:20:18 danw Exp $
#
# You should define your options in a ifhp.conf file in the spool
# directory,  or use the printcap ifhp=.... entry to get the options
#

#--- START debugging setup
# turn debugging on
# debug=5
# specify a specific file for output
#dev=/tmp/d
# specify a network connection
# dev=astart14%9100
# specify a serial line
#dev=/dev/ttya
#stty=38400 -echo -crmod -raw -oddp -evenp ixon pass8 -ixany cbreak

# put trace output on STDERR
# trace_on_stderr
# specify status file for testing
#--- END debugging setup

#  The summary file really slows down operation as it requires
#  a file system sync each time.  Writing to a UDP socket is very
#  fast
#summaryfile=summary

# Status file location and limits
# status file
#statusfile=status
statusfile_max=8
statusfile_min=2

# START language setup
# default is to turn everything on
pjl
pcl
ps
text
# do CRLF translation
# crlf

# Do NOT put PCL EOJ at start of job when PJL supported
#no_pcl_eoj
# Do NOT put PS EOJ at start of PS when PS is being printed
#no_ps_eoj

# Some printers get very upset when PostScript jobs contain ^T or ^C
# characters.  You can remove various control character by setting
# their values in this string:
#  remove_ctrl=TC   will remove CTRL-T and CTRLC characters
# remove_ctrl=TC

# Some printers insist on using the Tagged Binary Commmunication Protocol
# to support sending embedded PS file.  If you need to use TBCP, enable this.
#
# tbcp

# END lanuage setup


# START accounting extra information
# accounting script
#  accounting=accounting.sh
# END accounting extra information

# START printer status, sync, and pagecount
# information reporting
status
sync
sync_interval=20
pagecount
#pagecount_poll=5
pagecount_interval=20
waitend_interval=20
progress_pc=25
progress_k=100
# END printer status, sync, and pagecount

# START OF Mode operation
#banner=ps
#banner=pcl
banner@
banner_file=/usr/local/lib/filters/psbanner.ps
# END OF Mode operation


# START PJL configuration

pjl_only=[
    COMMENT DEFAULT DINQUIRE ECHO ENTER EOJ
    FSAPPEND FSDIRLIST FSQUERY FSUPLOAD FSDELETE FSDOWNLOAD FSINIT FSMKDIR
    INFO INITIALIZE INQUIRE JOB OPMSG PJL RDYMSG
    RESET SET STMSG USTATUS USTATUSOFF
# specials that expand variables correctly
    COPIES
 ]

pjl_except=[ ]
    
pjl_enter
pjl_job
pjl_console
pjl_init=[ ustatus teoj ]
pjl_term=[ ustatus teoj ]

# no value for setup
pjl_fontdir=/usr/local/lib/fonts/pjl
pjl_setup=[ font_download=\%s{setup} ]
setup=test

#   PJL USTATUS command string
#   
pjl_ustatus=
    @PJL USTATUS OFF
    @PJL USTATUS JOB = ON
    @PJL USTATUS DEVICE = ON
    @PJL USTATUS PAGE = ON
    @PJL USTATUS TIMED = 10

pjl_teoj= @PJL TEOJ = ON

# PJL Variables to be supported

pjl_vars_set= [
    AUTOCONF AUTOSELECT BINDING=LONGEDGE BITSPERPIXEL CLEARABLEWARNINGS
    CONTEXTSWITCH COURIER=REGULAR CPCLOCK DENSITY DISKLOCK
    DUPLEX ECONOMODE FINISH FORMLINES=60
    IMAGEADAPT INTRAY1 INTRAY2 
    INTRAY1SIZE INTRAY2SIZE INTRAY3SIZE INTRAY4SIZE
    INTRAY5SIZE INTRAY6SIZE INTRAY7SIZE INTRAY8SIZE
    IOBUFFER IOSIZE JOBATTR JOBOFFSET
    LANG=ENGLISH LOWTONER MANUALFEED
    MEDIASOURCE MEDIATYPE MPTRAY ORIENTATION=PORTRAIT OUTBIN=UPPER
    OUTLINEPOINTSIZE PAGEPROTECT
    PAPER=LETTER PARALLEL PERSONALITY=AUTO POWERSAVE POWERSAVETIME=30
    PRINTQUALITY=NORMAL QTY=1 RENDERMODE REPRINT=AUTO RESOLUTION
    RESOURCESAVE RESOURCESIZE RET TIMEOUT=600 WIDEA4
 ]

#
# Commands we have created:  upper, lower
# PJL Options we can set: autoselect autoconf
#

pjl_user_opts=[ inupper inlower outupper duplex outlower autoselect
    autoconf transparency setup ]
pjl_inupper=@PJL SET MEDIASOURCE = TRAY1
pjl_inlower=@PJL SET MEDIASOURCE = TRAY2
pjl_outupper=@PJL SET OUTBIN = UPPER
pjl_outlower=@PJL SET OUTBIN = LOWER
pjl_copies=@PJL SET COPIES = \%{copies}
pjl_transparency=@PJL SET MEDIATYPE = TRANSPARENCY

# do not put status out for these codes
# pjl_quiet_codes=[
    10001
 ]

# Special error messages
#  One per line
pjl_error_codes=[
    10006=Toner Low 
 ]


# PostScript Information
# define the ps_pagecount_code string to be used
# You MUST have the %!PS at the start
# or the printer gets very confused

# use the following string to cause the printer to echo
#  NAME is replaced by echo value

ps_status_code=
    %!PS-Adobe-2.0
# for PS Level 3 add:
#   false 0 startjob pop
    ( %%[ echo: NAME ]%% ) print () = flush


ps_pagecount_code=
    %!PS-Adobe-2.0
# for PS Level 3 add:
#   false 0 startjob pop
    /p{print}def ( %%[ pagecount: ) p
    statusdict begin pagecount end 20 string cvs p
    ( ]%% ) p () = flush

ps_user_opts=[ manual inupper inlower outupper outlower envelope mediaselect
    simplex duplex duplexshort font transparency
    ]

# support for font download
ps_fontdir=/usr/local/lib/fonts/ps
ps_font=[ font_download ]

ps_duplex=   statusdict begin true setduplexmode false settumble end
ps_lduplex=  statusdict begin true setduplexmode false settumble end
ps_sduplex=  statusdict begin true setduplexmode true settumble end
ps_simplex=  statusdict begin false setduplexmode end
ps_inupper=  statusdict begin 0 setpapertray end
ps_inlower=  statusdict begin 1 setpapertray end
ps_manual=   statusdict begin /manualfeed true store end
ps_envelope= statusdict begin com10envelopetray end
ps_outupper= statusdict begin 0 setoutputtray end
ps_outlower= statusdict begin 1 setoutputtray end
ps_transparency= <</MediaType (Transparency)>> setpagedevice



# The following values are from the PPD files for the HP5SiMx

# *ManualFeed True/True:
#ps_manual=<</ManualFeed true>> setpagedevice

mediaselect=3
ps_mediaselect=<</DeferredMediaSelection true /MediaPosition \%{mediaselect}>> setpagedevice

# *InputSlot Envelope/Envelope Feeder:
ps_envelope=<</DeferredMediaSelection true /MediaPosition 2>> setpagedevice

# HP 5SiMX
#ps_inupper=[ tray1 ]
#ps_inlower=[ tray2 ]


# *InputSlot Tray1/Tray 1:
ps_tray1=<</DeferredMediaSelection true /MediaPosition 3>> setpagedevice

*InputSlot Tray2/Tray 2: 
ps_tray2=<</DeferredMediaSelection true /MediaPosition 0>> setpagedevice

*InputSlot Tray3/Tray 3: 
ps_tray3=<</DeferredMediaSelection true /MediaPosition 1>> setpagedevice

*InputSlot Tray4/Tray 4: 
ps_tray4=<</DeferredMediaSelection true /MediaPosition 4>> setpagedevice

# *OutputBin Upper/Top Output Bin (Face Down):
#ps_outupper=<</Staple 0 /OutputType (TOP OUTPUT BIN)>> setpagedevice
# *OutputBin Left/Left Output Bin (Face Up):
#ps_outlower=
#   currentpagedevice /OutputAttributes get
#   5 known
#         {<</Staple 0 /OutputType (FACE UP BIN)>> setpagedevice}
#         {<</Staple 0 /OutputType (LEFT OUTPUT BIN)>> setpagedevice}
#       ifelse
#
# *OutputBin Stacker/Stacker (Face Down):
ps_outbin2=<</Staple 0 /OutputType (OPTIONAL OUTBIN 2)>> setpagedevice

# *OutputBin Separator/Job Separator (Face Down): 
ps_outbin3=<</Staple 0 /OutputType (OPTIONAL OUTBIN 2)>> setpagedevice

# *OutputBin Stapler/Stapler (Face Down):         
ps_outbin4=<</Staple 2>> setpagedevice

# *OutputBin OutputBin1/Mailbox 1 (Face Down):    
ps_outbin5=<</Staple 0 /OutputType (OPTIONAL OUTBIN 2)>> setpagedevice

# *OutputBin OutputBin2/Mailbox 2 (Face Down):    
ps_outbin6=<</Staple 0 /OutputType (OPTIONAL OUTBIN 3)>> setpagedevice

# *OutputBin OutputBin3/Mailbox 3 (Face Down):    
ps_outbin7=<</Staple 0 /OutputType (OPTIONAL OUTBIN 4)>> setpagedevice

# *OutputBin OutputBin4/Mailbox 4 (Face Down):    
ps_outbin8=<</Staple 0 /OutputType (OPTIONAL OUTBIN 5)>> setpagedevice

# *OutputBin OutputBin5/Mailbox 5 (Face Down):    
ps_outbin9=<</Staple 0 /OutputType (OPTIONAL OUTBIN 6)>> setpagedevice

# *Duplex None/Off: 
ps_simplex=
     <</Duplex false /Tumble false>> setpagedevice
# *Duplex DuplexNoTumble/Long-Edge Binding: 
ps_duplex=
     <</Duplex true /Tumble false>> setpagedevice
# *Duplex DuplexTumble/Short-Edge Binding: 
ps_duplexshort=
     <</Duplex true /Tumble true>> setpagedevice
# *End


#  PCL Strings
#   Initialization

pcl_user_opts=[
    bold clearmargins courier crlf delete_fonts duplex duplexback
    duplexfront duplexselect duplexshort fixed font font_id
    font_op font_primary height helvetica hmi init
    init inlower inupper italic jobseparation landscape leftmargin
    leftoffset lineprinter linesperpage linewrap lpi manual normalpage
    orientation outlower outupper pc8 pagesize pitch portrait proportional
    rightmargin simplex source style symbol_set topmargin topoffset
    typeface user_opts vmi weight
    pagesize letter legal ledger a3 a4 a5
 ]

# turn LF into CRLF
pcl_crlf=\033&k2G
# turn line wrap on
pcl_linewrap=\033&s0C

# page (job) size
#  use -Zpagesize=n
# 1 - executive, 2 - letter, 3 - legal, 6 - ledger, 25 - A5, 26 - A4, 27 - A3
# 80 - Monarch Envelope, 81 - Comm. 10 Envelope, 90 - Intl. DL Envelope
# 91 - Intl. C5 Envelope, 100 - Intl. D5 Envelope, 101 - Custom
# 71 - Hagaki Postcard, 72 - Oufuku-Hagaki Postcard
pagesize=2
pcl_pagesize=\033&l\%{pagesize}A
pcl_letter=\033&l2A
pcl_legal=\033&l3A
pcl_ledger=\033&l6A
pcl_a5=\033&l25A
pcl_a4=\033&l26A
pcl_a3=\033&l27A

# paper source selection
#   use -Zsource=n
# 0 - current, 1 - upper, 2 - manual paper, 3 - manual envelope
# 4 - lower,   5 - optional paper  - 6 - optional manual
source=0
pcl_source=\033&l\%{source}H
pcl_inupper=\033&l1H
pcl_manual=\033&l2H
pcl_inlower=\033&l4H

# orientation
#  0 - portrait, 1, landscape, 2 - reverse portrait, 3 reverse landscape
pcl_orientation=\033&l\%{orientation}O
pcl_portrait=\033&l0O
pcl_landscape=\033&l1O

# simplex or duplex
#  0 - simplex,  1 - duplex long edge, 2 - duplex short edge
pcl_simplex=\033&l0S
pcl_duplex=\033&l1S
pcl_duplexshort=\033&l2S

# offsets
#  these are specified in 1/720 inch units
#  i.e. - if you want 1/2 inch, you need  720 x .5 = 360 units
leftoffset=0
pcl_leftoffset=\033&l\%{leftoffset}U
topoffset=0
pcl_topoffset=\033&l\%{topoffset}Z

# duplex page side selection
duplex_select=1
pcl_duplexselect=\033&a\%{duplexselect}G
pcl_duplexfront=\033&a1G
pcl_duplexback=\033&a2G

# job separaton
pcl_jobseparation=\033&l1T

# output bin 
# 0 - auto, 1 - bin 1,top/facedown 2 - bin 2,left/faceup
# 3 - bin 3 (HCO faceup)
# 4 - bin 4 (HCO 1, facedown)
# 5 - bin 5 (HCO 2, facedown)
# 6 - bin 6 (HCO 3, facedown)
# 7 - bin 7 (HCO 4, facedown)
# 8 - bin 8 (HCO 5, facedown)
# 9 - bin 9 (HCO 6, facedown)
# 10 - bin 10 (HCO 7, facedown)
# 11 - bin 11 (HCO 8, facedown)

outbin=1
pcl_outbin=\033&l\%{outbin}G
pcl_outupper=\033&l1G
pcl_outlower=\033&l2G

# margins
pcl_clearmargins=\0339
leftmargin=0
pcl_leftmargin=\033&a\%{leftmargin}L
rightmargin=80
pcl_rightmargin=\033&a\%{rightmargin}M
topmargin=0
pcl_topmargin=\033&l\%{topmargin}E
linesperpage=66
pcl_linesperpage=\033&l\%{linesperpage}E

# the HMI (Horizontal Motion Index)
#  this is dangerous...
#  This is the number of 1/120 inch unit per character
#  i.e. - 120 unit per inch
#  If you want 10 cpi, you want HMI = 120/10 = 12
hmi=12
pcl_hmi=\033&k\%{hmi}H

# the VMI (Vertical Motion Index)
#  this is dangerous...
#  This is the number of 1/48 inch unit per line
#  i.e. - 48 unit per inch
#  If you want 6 lines per inch, you want HMI = 48/6 = 8
vmi=8
pcl_vmi=\033&l\%{vmi}C

# the LPI (Lines Per Inch) - inverse of VMI
#  This is the lines per line
#  If you want 6 lines per inch, you want LPI = 6
lpi=6
pcl_lpi=\033&l\%{lpi}D

# symbol set
#  - don't fool around with this one...
# 10U = PC 8 - shows the funny PC characters???
#
symbol_set=8U
pcl_symbol_set=\033(\%{symbol_set}
pcl_pc8=\033(10U

# spacing
#  0 - fixed, 1 - proportional
pcl_fixed=\033(s0P
pcl_proportional=\033(s1P

# pitch for fixed spaced font
#  in characters per inch
pitch=10
pcl_pitch=\033(s\%3.2f{pitch}H

# height for proportional spaced font
#  in points
height=12
pcl_height=\033(s\%3.2f{height}H

# style for proportional spaced font
#  0 - normal, 1 - italic, 4 condensed, etc
style=0
pcl_style=\033(s\%{style}S
pcl_italic=\033(s1S


# weight -
#  ranging from -7 (ultra thin) to 7 (ultra black)
weight=0
pcl_weight=\033(s\%{weight}B
pcl_bold=\033(s3B

# Typeface Family
# See Appendic C in the PCL 5 comparison guide
#   consists of foundary * 4096 + fontid
#   foundary = 1 - AGFA, 2- Bitstream, etc 
#   fontid   = 0 - line printer, 3 = courier, 4 = helvetica
#   id 4099 - Courier
#      4100 - Helvetica
#
typeface=4099
pcl_typeface=\033(s\%{typeface}T
pcl_courier=\033(s4099T
pcl_helvetica=\033(s4100T
pcl_lineprinter=\033(s0T


#
# Fonts and Font Downloading
#  fontid is used to set the current font
font_id=1
pcl_font_id=\033*c\%{font_id}D
# set primary font
font_primary=1
pcl_font_primary=\033(\%{font_primary}X

# font control
#
font_op=0
pcl_font_op=\033*c\%{font_op}F
pcl_delete_fonts=\033*c0F

# font directory
font=c1201b.10
pcl_fontdir=/usr/local/lib/fonts/pcl

# combination command
pcl_font=[ delete_fonts font_id font_download font_primary ]

# canned setup
pcl_normalpage=[ letter crlf linewrap portrait clearmargins fixed pitch=10 courier ]

pcl_init=[ normalpage ]

#
# text conversion control
#
# control text to whatever conversion
#
# if you cannot find type, then try this file utility
#
# if the type is text and not supported on your system, do a conversion
#  Method 1 - set 'default_language' as text, and run
#    the program through a text to known converter
#
default_language=text
text_converter=/usr/local/bin/a2ps -q -B -o-
# output of the converter is pcl, ps, or raw
text_converter_output=ps

#  
#  Method 2 - 
#    Use the file util and match the output
# file reports format information
#  glob text_output_format text_converter
#  - you do a glob match against pattern and use the converter
#
default_language=unknown
file_util_path=/usr/bin/file -
file_output_match = [
 *text*  ps /usr/local/bin/a2ps -q -B -o-
 ]
# you need a temp file location
tempfile=/var/tmp/ifhp

# Printer Specific Configurations

# Apple or PostScript Printers
[ apple postscript ps ]
pjl@
pcl@
ps
text@

# HP Printers
# These all support PJL to a limited extent and PCL as well
# 
[ hpiiisi ]
pjl_only=[
    COMMENT ENTER
 ]

[ hp4 hp4m hp4si hp4simx hp4plus hp4mplus hp4v hp4mv hp4p hp4mp hp4pj hpljpro hp4lc ]
pjl_except=[
    FSAPPEND FSDIRLIST FSQUERY FSUPLOAD FSDELETE FSDOWNLOAD FSINIT FSMKDIR
 ]

[ hp4l hp5l hp6l ]
pjl_except=[
    EOJ JOB OPMSG RDYMSG STMSG
    FSAPPEND FSDIRLIST FSQUERY FSUPLOAD FSDELETE FSDOWNLOAD FSINIT FSMKDIR
 ]

[ hp4ml hp5p hp5mp hp6p hp6mp ]
pjl_except=[
    OPMSG RDYMSG STMSG
    FSAPPEND FSDIRLIST FSQUERY FSUPLOAD FSDELETE FSDOWNLOAD FSINIT FSMKDIR
 ]

[ hp5si hp5simx hp5 hp5m ]
pjl_except=[
    FSAPPEND FSDIRLIST FSQUERY FSUPLOAD
 ]

[ hp5simopier hp4000 ]
pjl_except= [
 ]

[ hpcolorlj hpcolorlj5 hpcolorlj5m ]
pjl_only=[
    COMMENT ECHO ENTER EOJ
    INFO INITIALIZE INQUIRE JOB PJL RDYMSG
    USTATUS USTATUSOFF
 ]

[ hpdj1200c hppjxl300 ]
pjl_only=[
    COMMENT ENTER
    PJL
 ]
status@

[ hpdj1600c ]
pjl_only=[
    COMMENT DEFAULT DINQUIRE ECHO ENTER EOJ
    JOB PJL
    RESET SET
]
[ hpdj200 hpdj220 hpdj350c hpdj600 hpdj650c ]
pjl_only=[
    COMMENT ECHO ENTER
    INFO 
    USTATUS USTATUSOFF
 ]
[ hpdj230 hpdj250c hpdj330 hpdj350c hpdj430 hpdj450c hpdj455ca hpdj700 hpdj750c hpdj750cplus hpdj755cm hpdj2000cp hpdj2500cp ]
pjl_only=[
    COMMENT ECHO ENTER EOJ
    INFO JOB RESET SET
    USTATUS USTATUSOFF
 ]

[ qms1725 ]
pjl@
pcl@
ps_duplex=   1 dict dup /Duplex true put setpagedevice
       1 dict dup /Tumble false put setpagedevice
ps_lduplex=  1 dict dup /Duplex true put setpagedevice
       1 dict dup /Tumble true put setpagedevice
ps_sduplex=   1 dict dup /Duplex true put setpagedevice
       1 dict dup /Tumble false put setpagedevice
ps_simplex=  1 dict dup /Duplex false put setpagedevice
       1 dict dup /Tumble false put setpagedevice

ps_inupper= 
   currentpagedevice /InputAttributes get 1 get
   dup null eq
   { pop }
   { dup length 1 add dict copy
     dup /InputAttributes
     1 dict dup /Priority [1] put
     put setpagedevice
   } ifelse

ps_inlower=
   currentpagedevice /InputAttributes get 2 get
   dup null eq
   { pop }
   { dup length 1 add dict copy
     dup /InputAttributes
     1 dict dup /Priority [2] put
     put setpagedevice
   } ifelse

ps_manual=   1 dict dup /ManualFeed true put setpagedevice

ps_envelope= statusdict begin com10envelopetray end
   currentpagedevice /InputAttributes get 3 get
   dup null eq
   { pop }
   { dup length 1 add dict copy
     dup /InputAttributes
     1 dict dup /Priority [3] put
     put setpagedevice
   } ifelse
ps_outupper= 
  currentpagedevice /OutputAttributes get 1 get
  dup null eq
  { pop }
  { dup length 1 add dict copy
    dup /OutputAttributes
    1 dict dup /Priority [1] put
    put setpagedevice
  } ifelse

ps_outlower=
  currentpagedevice /OutputAttributes get 2 get
  dup null eq
  { pop }
  { dup length 1 add dict copy
    dup /OutputAttributes
    1 dict dup /Priority [2] put
    put setpagedevice
  } ifelse

