Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printring 80col to 132 (\015) 1

Status
Not open for further replies.

LinuXelite

Programmer
Jun 21, 2002
150
CA
Hi!

I need to print a document with 135 cols instead of 80 cols (now it prints on 80 cols).

What do I need to configure? I use a basic, generic serial printer.

Here the script I have to modify.

To print with 132 cols to I need to change the code (015)?
Do I need to change the term? ansi? vt100?

Im not familiar with Unix printer.
Thank you for your help. I marked helpfuls tips ;o)

usage="USAGE: $0 [files]"
tmpname="/tmp/tr$$"
devout="/dev/tty"
case $TERM in
ansi)
pxon="\033[5i"
pxoff="\033[4i"
;;
esac
if [ $# -ne 0 ]
then
if [ $1 = "-nf" ]
then
ff=""
shift
else
ff="\f\c"
fi
fi
#
# Impression du rapport
#
if [ $# -ne 0 ]
then
echo "\c" > ${tmpname}
while [ $# -ne 0 ]
do
cat $1 >> ${tmpname}
echo "${ff}" >> ${tmpname}
shift
done
else
cat > ${tmpname}
fi
sleep 1
echo "${pxon}\c" > ${devout}
cat ${tmpname} > ${devout}
echo "${pxoff}\c" > ${devout}
rm ${tmpname}
 
Basically what you've got here is a script that turns on terminal printing, dumps the print file out to the terminal which sends it directly to the printer, and then turns terminal printing off.

To get 135 character wide print does not require changing any of your terminal settings. You just need to modify the script to send the escape sequence that sets your printer to condensed print so your 135 characters will fit on the page. Refer to your printer manual for the correct escape sequences to turn condensed print mode on and back off, then try modifying your script as follows.

...
condon="escape sequence to turn on condensed print"
condoff="escape sequence to turn off condensed print"
echo "${pxon}\c" > ${devout}
echo "${condon}\c" > ${devout}
cat ${tmpname} > ${devout}
echo "${condoff}\c" > ${devout}
echo "${pxoff}\c" > ${devout}
rm ${tmpname}
 
I think the escape sequence is \015

I'll try this :)


Thank you! I'll let you know if it worked.

 
I found the command...

ON: ESC SI or SI
OFF: DC2

How to I translate these command for my script? I guess I need a value like \015... ?

Thanks
 

octal:
|000 nul |001 soh |002 stx |003 etx |004 eot |005 enq |006 ack |007 bel |
|010 bs |011 ht |012 nl |013 vt |014 np |015 cr |016 so |017 si |
|020 dle |021 dc1 |022 dc2 |023 dc3 |024 dc4 |025 nak |026 syn |027 etb |
|030 can |031 em |032 sub |033 esc |034 fs |035 gs |036 rs |037 us |
|040 sp |041 ! |042 " |043 # |044 $ |045 % |046 & |047 ' |
|050 ( |051 ) |052 * |053 + |054 , |055 - |056 . |057 / |
|060 0 |061 1 |062 2 |063 3 |064 4 |065 5 |066 6 |067 7 |
|070 8 |071 9 |072 : |073 ; |074 < |075 = |076 > |077 ? |
|100 @ |101 A |102 B |103 C |104 D |105 E |106 F |107 G |
|110 H |111 I |112 J |113 K |114 L |115 M |116 N |117 O |
|120 P |121 Q |122 R |123 S |124 T |125 U |126 V |127 W |
|130 X |131 Y |132 Z |133 [ |134 \ |135 ] |136 ^ |137 _ |
|140 ` |141 a |142 b |143 c |144 d |145 e |146 f |147 g |
|150 h |151 i |152 j |153 k |154 l |155 m |156 n |157 o |
|160 p |161 q |162 r |163 s |164 t |165 u |166 v |167 w |
|170 x |171 y |172 z |173 { |174 | |175 } |176 ~ |177 del |




found it:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top