I have a script used to produce PDF output from a text file. It needs to be self-contained so it can be used as a filter from an application.
Current script:
I need the "792" above to be a configurable variable, based upon the longest line in the print stream.
I tried this:
The contents of "lcount" are:
As somewhat expected, the result is that my "lcount" gets over-written by the print stream, instead of being used to accept the STDIN and produce the output I want to use later in the script.
Ultimately, this is probably a problematic way to accomplish my goal anyway. I really don't want to resort to creating, then reading a text file just to get the line length. But, I also need to DEVICEWIDTHPOINTS parameter to be reasonable.
There isn't much documentation I can find for ps2pdf, but maybe there is a better way to scale the output to fit a page?
"Proof that there is intelligent life in Oregon. Well, Life anyway.
Current script:
Code:
sed '1,2 s/\^L//'|/usr/spool/lp/bin/text2post|ps2pdf -dDEVICEWIDTHPOINTS=792 - | lp -dPC
I tried this:
Code:
sed '1,2 s/\^L//'|tee /usr/local/bin/lcount|/usr/spool/lp/bin/text2post|ps2pdf -dDEVICEWIDTHPOINTS=`cat /usr/tmp/$LOGNAME.lc` - | lp -dPC
Code:
#!/bin/ksh
while read line
do
echo ${#line}
done |sort -n|tail -1 >/usr/tmp/$LOGNAME.lc
Ultimately, this is probably a problematic way to accomplish my goal anyway. I really don't want to resort to creating, then reading a text file just to get the line length. But, I also need to DEVICEWIDTHPOINTS parameter to be reasonable.
There isn't much documentation I can find for ps2pdf, but maybe there is a better way to scale the output to fit a page?
"Proof that there is intelligent life in Oregon. Well, Life anyway.