Hello,
First time poster long time code monkey here. I would like to see an article that deals with printing from the command line, specifically printing good looking documents from the command line. Look at this:
<?
$res = mysql_query("select text from story") or die(mysql_error());
for ($x=0; $x<mysql_num_rows($res); $x++)
{
$pre_form_story = mysql_result($res,$x,"text");
$formatted_story = preg_replace("/UgLy TeXt/","/Nice Formatting/",$pre_form_story);
$fp = fopen("myStory.txt", "rw");
fputs($formatted_story, $fp) or die("Uh-oh");
fclose($fp);
exec("/usr/local/bin/some_kewl_document_formatter myStory.txt > my_new_spiffy_story.rtf");
exec("/usr/local/bin/convert_to_ps my_new_spiffy_story.rtf");
exec("lp my_new_spiffy_story.ps");
unlink("my_new_spiffy_story.ps");
unlink("my_new_spiffy_story.rtf");
unlink("myStory.txt");
}
?>
}
This is a crude example of what i am having problems with is finding a way to take output, write to a file, which is easy, then automate a way to format it with cool fonts and designs, print it and clean up after itself. Any ideas?
I thought about using TeTex to do all this but it is a little difficult to use. Before I exhaust a week figuring out a way to do this I thought I would post it here.
Thanks!