-1

Wrote a script in bash. Now im need to bring information into a text file,for example in PostScript, but there is one problem. I need to have a certain length of string in characters, and stretch or shrink the string on the entire width of the page layout. I have tried a2ps and enscript, but there is no such option. Please tell me the solution to this problem, maybe in Ghostscript. How to change letter spacing to fill the lines? Thanks in advance!

For example:

Input

aaa
bbbb
ccccccc

Output

a  a  a
b b b b
ccccccc
Uncle Leo
  • 15
  • 2
  • I love playing "guess what my script looks like." Since you didn't post any code, in this case, I'm guessing...you need the [fmt](http://www.oreillynet.com/linux/cmd/cmd.csp?path=f/fmt) command. – Todd A. Jacobs Jun 06 '12 at 22:15
  • `fmt` and `fold` commands do not stretch or shrink the text. I don't use monospaced font. I need to fill my lines by changing the letter spacing. – Uncle Leo Jun 06 '12 at 22:31

2 Answers2

0

There are basically three steps to your process:

  1. Generate your text file (e.g. your shell script)

  2. Format for printing (perhaps convert to Postscript, e.g. via a2ps, possibly something else entirely, like "troff")

  3. Output the formatted results to the printer (e.g. "lpr")

paulsm4
  • 114,292
  • 17
  • 138
  • 190
  • I need to have a certain length of string in characters, and stretch or shrink the string on the entire width of the page layout. With what command or program i can do this? – Uncle Leo Jun 06 '12 at 22:10
  • In postscript, the selectfont and setfont operators set the font scaling. – starbolin Jun 06 '12 at 22:43
0
sed -e 's/./& /g' -e 's/$/\\p/' < inputfile | groff -Tascii

Use groff to do the adjustment, but groff will only adjust words, so use sed first to make each character a word. You can use groff to output postscript instead if you want different fonts or nicer printing or whatever.

evil otto
  • 10,348
  • 25
  • 38