Adding page eject on spooler close

I have set my default printer to a network attached Brother HL-2150N. Irritatingly the end of files is not printed until the page eject button is pressed. How can I add a page eject to the end of the files?

My /etc/printcap looks like this:

Code:
lp|Brother HL-2150N:lp=:rm=192.169.0.11:rp=brother:sd=/var/spool/brother:if=/usr/local/libexec/lf2crlf:

My lf2crlf interface file looks like this:

Code:
#! /bin/sh
# /usr/local/libexec/ls2crlf
CR=$'\r'
/usr/bin/sed -e "s/$/${CR}/g"
 
If you don't specify a filter in your printcap, a formfeed will be appended automatically at the end of the job.

Because your filter appear to do only a conversion from LF to LF+CR, I think you could setup your printer to use LF only instead of LF+CR and remove the software filter.

Alternatively you need to use a filter that add a formfeed at the end of the file to print, something like:
ff-filter
Code:
#!/bin/sh
#
cat
echo -n \\f

and use the following filter in printcap:
Code:
if=/usr/local/libexec/lf2crlf | ff-filter
Adjust the ff-filter path as you see fit.

Hope it is correct, many years are past from last time I used lpd.
 
If you don't specify a filter in your printcap, a formfeed will be appended automatically at the end of the job.

Because your filter appear to do only a conversion from LF to LF+CR, I think you could setup your printer to use LF only instead of LF+CR and remove the software filter.

Alternatively you need to use a filter that add a formfeed at the end of the file to print, something like:
ff-filter
Code:
#!/bin/sh
#
cat
echo -n \\f

and use the following filter in printcap:
Code:
if=/usr/local/libexec/lf2crlf | ff-filter
Adjust the ff-filter path as you see fit.

Hope it is correct, many years are past from last time I used lpd.
Thank you for the suggestion, but lpd/ lprdoesn't like the if= section, I get
Code:
lpd[741]: lp: cannot execv(/usr/local/libexec/lf2crlf | /usr/local/libexec/ff-filter): No such file or directory

Perhaps I should try whatever-it-is you use? /etc/printcap mentions apsfilter. Is that a good alternative, apsfilter.org seems to be down?
 
I see, lp want a single filter ... can be work around by creating a new filter which include both

/usr/local/libexec/lf2crlf-ff
Code:
#!/bin/sh
/usr/local/libexec/lf2crlf | /usr/local/libexec/ff-filter

and using if=/usr/local/libexec/lf2crlf-ff in /etc/printcap

Additionally, be sure that the filters have "execute" permissions.

apsfilter ... guess it is a converter from ascii to postscript ... isn't going to work if the printer doesn't support postscript directly.

Let see if the workaound is enough ... else post back.
 
It would be simpler just to create a single filter that does both. If sed(1) exits when the input ends, could just copy lf2crlf to a new file and add
Code:
printf "\f"
to the end.
 
It would be simpler just to create a single filter that does both. If sed(1) exits when the input ends, could just copy lf2crlf to a new file and add
Code:
printf "\f"
to the end.
Aha! That did it. /etc/lf2crlf now looks like this:
Code:
#! /bins/h
# /usr/local/libexec/lf2crlf
# converts carriage return to cr+lf
CR=$'\r'
/usr/bin/sed -e "s/$/${CR}/g"
printf "\f"

Thanks all.
 
Back
Top