Operating System - HP-UX
1834420 Members
1867 Online
110067 Solutions
New Discussion

Forcing an end-of-job formfeed using lp

 
Steve Longenecker
Frequent Advisor

Forcing an end-of-job formfeed using lp

My Okidata impact printers stop printing immediately following the last line of text unless there is a formfeed embedded in the file. Is it possible to force an end-of-job formfeed from the command line using lp without manipulating file that is printed?
4 REPLIES 4
Jeff Schussele
Honored Contributor

Re: Forcing an end-of-job formfeed using lp

Hi Steve,

Depends on how the printer is defined to the system.

If it's a local or network printer then you can edit the interface file to insert a FF (Dec 12 / hex C / octal 014) after the job is sent.
Look at the /usr/lib/model/dumb file it has it in the
# Print the spooled files
section.

If it's a remote printer, then you'll have to imbed the /014 into the end of the file.

Rgds,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Steve Longenecker
Frequent Advisor

Re: Forcing an end-of-job formfeed using lp

Thanks, but I am unfortunately working with remote printers and modifying the file is not an option.
A. Clay Stephenson
Acclaimed Contributor

Re: Forcing an end-of-job formfeed using lp

Here's a pretty sneaky way to outbushwhack this puppy. We are going to hijack the file from the request queue before sending it to the rlp command.

I'll assume that your printer is called "Oki" on the local host. We need to modify /var/spool/lp/interface/Oki and make a few changes. We are also armed with the knowledge that Oki's requests are stored in
/var/spool/lp/request/Oki as "d*RequestNumberLocalHostName"


cd to /var/spool/lp/interface
cp Oki Oki.sav
modify Oki and make these changes just before the rlp command:

DIRNAME=/var/spool/lp/request/${printer}
REQNO=$(echo "${requestid}" | awk -F'-' '{print $NF}')
FNAME=${ls ${DIRNAME}/d*${REQNO}[A-Za-z_]*)
if [[ -f "${FNAME}" ]]
then
chmod 640 ${FNAME}
echo "\f\c" >> ${FNAME}
chmod 440 ${FNAME}
fi
usr/sbin/rlp -I$requestid ....

That should do the trick. Note that we have to briefly write-enable the file before the echo; we then return it to read-only before handing it off to rlp. I do assume that your host name starts with A-Z,a-z, or "_".


If it ain't broke, I can fix that.
Steve Longenecker
Frequent Advisor

Re: Forcing an end-of-job formfeed using lp

This looks like a potential solution, but unfortunately the code does not work as written. I'll have to tinker with the code and test. Thanks...