LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-04-2009, 02:51 PM   #1
MiamiLoco
LQ Newbie
 
Registered: Nov 2009
Posts: 5

Rep: Reputation: 0
Bash shell script: Txt to Postscript form??!!


Hi, I was wondering if someone could help me out or point me in the right direction. What's the best way to write a Bash Shell script to generate a txt file into Postscript form?
 
Old 11-04-2009, 03:06 PM   #2
pcunix
Member
 
Registered: Dec 2004
Location: MA
Distribution: Various
Posts: 149

Rep: Reputation: 23
apropos Postscript

text2ps - convert text files to PostScript
 
Old 11-04-2009, 03:07 PM   #3
MiamiLoco
LQ Newbie
 
Registered: Nov 2009
Posts: 5

Original Poster
Rep: Reputation: 0
Thanks for the quick reply, but what would be the actual bash script loop that would do this?
 
Old 11-04-2009, 03:11 PM   #4
pcunix
Member
 
Registered: Dec 2004
Location: MA
Distribution: Various
Posts: 149

Rep: Reputation: 23
Huh?

There's no loop.

text2ps file > newpsfile

By some funny chance, could this possibly be a homework assignment???
 
Old 11-04-2009, 03:13 PM   #5
pcunix
Member
 
Registered: Dec 2004
Location: MA
Distribution: Various
Posts: 149

Rep: Reputation: 23
If you need to understand looping, try this: http://aplawrence.com/Basics/bash_looping.html
 
Old 11-04-2009, 03:14 PM   #6
tuxdev
Senior Member
 
Registered: Jul 2005
Distribution: Slackware
Posts: 2,012

Rep: Reputation: 115Reputation: 115
http://en.wikipedia.org/wiki/PostScript

Let's look at hello world:
Code:
%!PS
/Courier findfont
20 scalefont
setfont
72 500 moveto
(Hello world!) show
showpage
20pt is a bit large, 12pt would do. A basic way to do this is:
1. Start the vertical cursor at say, 750
2. For each line in the text field (while read -r LINE ; do)
a. Tell it to move the actual cursor to (50, <bash cursor>)
b. Tell it to show the line
c. Decrement the vertical cursor by say, 16
 
Old 11-04-2009, 03:15 PM   #7
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
You might have a2ps (ASCII to Postscript). Works just like test2ps.
--- rod.
 
Old 11-04-2009, 03:24 PM   #8
pcunix
Member
 
Registered: Dec 2004
Location: MA
Distribution: Various
Posts: 149

Rep: Reputation: 23
Well, yeah, if you want to write your own Postscript, then TuxDev's post is where you want to start. If you need to get into it in depth, there aee PDF references at http://www.adobe.com/devnet/postscript/
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
bourne shell script: Txt to PDF?!! MiamiLoco Programming 2 11-03-2009 12:38 PM
shell script for changing a txt file content Flobsi Linux - Newbie 3 10-06-2006 03:10 AM
shell script for changig txt-file content Flobsi Programming 1 10-05-2006 05:46 PM
how to switch form bash to another shell slim27616 SUSE / openSUSE 1 02-06-2005 12:34 PM
shell script works form command line but not form crontab saifee General 1 10-14-2004 10:27 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:04 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration