Results 1 to 5 of 5
is there any way of creating prn files(Print to file) automatically on linux ??
I use Php, Mysql and Apache. I take some visitor information, i put them in the ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 03-12-2003 #1Just Joined!
- Join Date
- Mar 2003
- Location
- UK
- Posts
- 2
Print to file
is there any way of creating prn files(Print to file) automatically on linux ??
I use Php, Mysql and Apache. I take some visitor information, i put them in the db and I need to take them out, create a prn file and than sent it to one of my customers!
Is this possible????
I am thinking to use cron to run a script every few hours, but I don't know if it works for I am not using Linux!!!
I hope you will still answer me after the last statement!! :P
- 03-12-2003 #2Linux Guru
- Join Date
- Oct 2001
- Location
- Täby, Sweden
- Posts
- 7,578
It's more than possible, it's really the way it works. All UNIX programs print using PostScript, it just that normally the PostScript data is directly piped into the printing program. Only very strange programs would not allow you to save it to a file instead, since files and pipes work almost exactly the same.
One advantage with PostScript is also that, if your customers don't like PostScript, it's easily converted into a diversity of other formats, like PDF.
- 03-12-2003 #3Just Joined!
- Join Date
- Mar 2003
- Location
- UK
- Posts
- 2
so what should I do??? cause my mind is really foggy at this moment!!!
- 03-13-2003 #4Linux Guru
- Join Date
- Oct 2001
- Location
- Täby, Sweden
- Posts
- 7,578
Well, I'm not sure just how you want it. What is it that you're doing with your system right now and what is it that you want it to do? Are you hosting multiple sites or something (considering apache and several customers)?
- 03-13-2003 #5Linux Enthusiast
- Join Date
- Jun 2002
- Location
- San Antonio
- Posts
- 621
sure, this is possible. You will need to write a script of some sort though, which requires some programming technique. Lets see, here is a shell of what you need (in bash)
PS, don't trust my code, don't try and run it on anything. It might kill your cat or give your grandmother herpes or something. You never know.Code:FILE=stuff.prn head() { #echo "This is the header of my letter" } format() { #this is where you do some crazy cut/grep command to format #the stuff the way you want it } body() { #this is where you do some crazy mysql command like: #mysql_output=mysql -u username -ppassword -e 'select * from stuff;' format mysql_output } tail() { #echo "This is the tail of my letter" } echo "What file name" read filename head >> $filename body >> $filename tail >> $filename
I respectfully decline the invitation to join your delusion.


Reply With Quote
