I'm generating a PDF based on a Latex document.
The Latex is actually a template being processed by Perl, and
I want the PDF to be output from a CGI (as an "application/pdf" mime-type).
My problem is I can't simply do this:
./parser.pl | latex | dvipdf
Because "latex" doesn't read from STDIN or write to STDOUT.
Neither does "dvipdf".
So what I'm doing for the time being is this:
./parser.pl | ./tex2pdf.sh
Where "tex2pdf.sh" is a shell script which reads from STDIN and generates
a temporary file:
cat > out.tex
It then runs "latex" on that file:
latex out.tex 2> /dev/null # Don't output "I'm TeX version BLAH"! >:^(
Then it runs "dvipdf" on _that_ file:
dvipdf out.dvi
And finally, spits the resulting PDF to STDOUT:
cat out.pdf
This requires that I have a number of temporary files ready to
be written to by these (via the CGI's system or pipe call to
"./parser.pl | ./tex2pdf.sh"):
Of course, I need:
out.tex - to capture the parsed TeX template
out.dvi - what "latex" makes when you run it on "out.tex"
out.pdf - the end result, which "dvipdf" makes based on "out.dvi"
_AND_, I need these:
out.aux
out.log
Two files which "latex" and/or "dvipdf" make for heaven-knows-what reason.
Is there a simpler way? This whole temp. file this is complete crap, and
will NOT be suitable for production! (The files will get clobbered by
multiple simultaneous calls to the CGI, unless I do some kind of stupid
file locking, in which case the speed of the system will drop dramatically)
HELP!
-bill!