Date: Thu, 1 Jan 2004 23:32:09 +1030 From: Malcolm Kay <malcolm.kay@internode.on.net> To: pixfbsd <pixfbsd@earthlink.net> Cc: stable@freebsd.org Subject: Re: printer job date change Message-ID: <200401012332.09442.malcolm.kay@internode.on.net> In-Reply-To: <1072923736.10332.7.camel@viper.dlqj.net> References: <1072838049.5571.8.camel@viper.dlqj.net> <200312311538.29609.malcolm.kay@internode.on.net> <1072923736.10332.7.camel@viper.dlqj.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 1 Jan 2004 12:52, pixfbsd wrote: > On Tue, 2003-12-30 at 23:08, Malcolm Kay wrote: > > On Wed, 31 Dec 2003 13:04, pixfbsd wrote: > > > I have FreeBSD 5.2-CURRENT. > > > > > > /etc/printcap > > > hp2200:\ > > > > > > :sh:\ > > > :rm=3Dhp2200:\ > > > :sd=3D/var/spool/output/lpd/hp2200:\ > > > :mx#0:\ > > > :if=3D/usr/local/libexec/hpif2:\ > > > :lf=3D/var/log/lpd-errs: > > > > > > /usr/local/libexec/hpif > > > > I notice that the actual filter referenced in printcap is hpif2; > > not hpif. > > oops my mistake, I have another hp printer in the printcap that also > references hpif. I cp hpif hpif2. And was experimenting with differen= t > PJL commands to try to get it to change the date. Therefore the > discrepancy. > > > I would have expected that this would be where the PJL command is > > added. > > > > If some how it is added ahead of the filter you could edit the filter= to > > pass the input though sed to change the date in the PJL command > > to whatever you want. > > do you have an example idea? or a possible syntax form as a experiment > point. I actually tried to grep the specific date out but since the > dfA009exampleFile is a binary file, it errors. I'm not too good with > sed. Since it is a binary file I'm not sure how well it will go (I guess it is= PCL for which I can't remember off hand the coding) but if you canedit it wit= h vi and still get a reasonable result there is a good chance sed will manage = it. Try replacing the filter line: printf "\033&k2G" && cat && printf "\033&l0H" && exit 0 with printf "\033&k2G" && sed -e 's/@PJL SET DATE=3D[0-3][0-9]-[01][0-9]-20= [0-9][0-9]/@PJL SET DATE=3D01-12-2000/g' && printf "\033&l0H" && exit 0 (This assumes that day and month are always encoded as 2 digits each) It might not work but I think it is at least worth a try ;-) Please let us know what happens. If it doesn't work a simple filter written in C should easily do the tric= k. > > Other pertinent information I left out. I'm running a SAMBA server tha= t > is getting the print job from a windows machine. I was assuming that > the PJL information was coming from the HP drivers on the windows > workstation. > Ah! Yes, I was wondering where it cound be coming from. > > > #!/bin/sh > > > # > > > # hpif - Simple text input filter for lpd for HP-PCL based printers > > > # Installed in /usr/local/libexec/hpif > > > # > > > # Simply copies stdin to stdout. Ignores all filter arguments. > > > # Tells printer to treat LF as CR+LF. Ejects the page when done. > > > > > > > > > printf "\033&k2G" && cat && printf "\033&l0H" && exit 0 > > > exit 2 > > > > > > In the dfA009exampleFile in /var/spool/output/lpd/hp2200 there is t= he > > > value @PJL SET DATE=3D31-12-2003. I want to create a filter that w= ill > > > change that value to the year 2000. > > > > > > Why? If you recall HP has date information in their printer > > > cartridges, that after a certain date the cartridge becomes "expire= d".=20 > > > Although you have plenty of ink or a cartridge that has been on the > > > shelf for along time. > > > > > > If I manually vi the file I can print, therefore I was trying to fi= nd a > > > filter that would send the PJL command to set the date to a default > > > 01-12-2000 all the time. Malcolm Kay
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200401012332.09442.malcolm.kay>
