Operating System - HP-UX
1826490 Members
3704 Online
109692 Solutions
New Discussion

Form Feeds, /etc/lp/interface/model.orig, and SED

 
John-Thomas Gaietto
Trusted Contributor

Form Feeds, /etc/lp/interface/model.orig, and SED

Hey everyone I'm currently trying to fix an issue with a printer which in the firm wear only prints when receiving ^L aka \014\c aka Form feed. I've added echo "\014\c" to my /etc/lp/interface/model.orig file for that printer, and this only helps with printing one page, if the document is multiple pages, it just cuts it off after the first page (which is 26 lines with this printer) I've also tried using sed with my model.orig file looking like so...

------------------------------
#!/usr/bin/sh
# Source: /users/hpnp/odyssey/repository/sh/dumbplot.psh
# @(#)B.11.11_LR
#
# lp interface for dumb plotter
#

copies=$4

# Handle disable and cancel traps
trap "trap 15;kill -15 0;exit 0" 15

# The remaining arguments are files

shift; shift; shift; shift; shift
files="$*"

# Plot the spooled files


i=1
while [ $i -le $copies ]
do
for file in $files
do
#send the file to sed, and
# 1) remove the ~^L from the first line.
# 2) remove ^L that are on lines by themselves
# 3) replace any ~^L with a single ^L from any other lines.
# These tend to be the headers from Multiple Transactions.
# 4) Insert a ^L (form feed) on the "Continuation voucher"
# lines.
#
# Finally, add a ^L to the end of the file.

cat "$file" 2>&1 | sed '
1s/~^L//p
s/^L$//
s/~^L/^L/
s/^Contin/^LContin/
$s/^/^L/p'
done
i=`expr $i + 1`
done

exit 0

------------------------------

This however doesn't work, and if I'm doing something wrong I can't figure it out. Also if anyone has any idea on how to approach this issue for a different angle I'd really appreciate some help.

Thanks in advance,

J-T
4 REPLIES 4
Rich Wright
Trusted Contributor

Re: Form Feeds, /etc/lp/interface/model.orig, and SED

I think you need to echo a ^L after the "done" loop and before "exit 0".
This should push out the final page.
Rich Wright
Trusted Contributor

Re: Form Feeds, /etc/lp/interface/model.orig, and SED

Also for debugging, redirect the output of "cat" to a file. Then look at it with xd or a binary editor.
I don't use sed that way.
I will use
sed -e 's/x/y/' -e 's/a/b/' ...
Steve Steel
Honored Contributor

Re: Form Feeds, /etc/lp/interface/model.orig, and SED

Hi


What are you printing on .

This is how I split a file into 60 line chunks to print.



file=$1
let length=`cat $file|wc -l`
let start=1
let x=0
q=""
while [ "$start" -le "$length" ]
do
let x=$x+1
tail -n +$start $file|head -n 60 > /tmp/printfax$x
let start=$start+60
q=$q" "/tmp/printfax$x
done
lp -dbelgo161 $q
/bin/rm /tmp/printfax*

Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
John-Thomas Gaietto
Trusted Contributor

Re: Form Feeds, /etc/lp/interface/model.orig, and SED

(I'm not quite sure what you mean from) But i'm printing from lp. See there is a program that makes an LP call to a specified printer to print a report. The printer will print however if I print lp -d I want it to print the file, insert the FF after 26 lines, then print to the next page. With out having to run the print job through another script, because the application won't allow me to do that.