Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm doing servlet programming and i was wondering if pdfTeX or pdfLaTeX have some handle for input or output bytestreams under windows. This way I could stream a string right in and stream the output as a PDF response to the client...any ideas?

share|improve this question
1  
As Heiko mentioned in his answer, sometimes we need multiple runs in order to reach a steady state for our .tex file, so one run might not be enough. Besides, sometimes we have documents that might take a considerable time to be generated, so we need to pay attention to the session timeout of the servlet container. Personally, I'd try to play with some webservice instead (input: file, output: file), but that's a matter of taste. :) –  Paulo Cereda Aug 18 '12 at 1:00

1 Answer 1

To some degree pdfTeX can read standard input. But it is not unusual compile a LaTeX file more than once, e.g. for the table of contents or to get the references right.

As output files (pdf)TeX writes a .log file at any case and the output file is not suitable for streaming, because pdfTeX jumps back in the written output file. (It writes the length of the stream of a PDF stream object in the dictionary of this object before the stream part.) And LaTeX might want to write auxiliary files (.aux, .toc, …).

Thus the servlet could read the input stream, writes it in a file in a temporary directory and call (pdf)(la)tex (or whatever TeX compiler/format). Then the .log file needs to be analyzed for rerun stuff. Also other programs like bibtex or makeindex might need to be calling.

Then if the compile runs are finished, the output file can be streamed back and the temporary directory can be cleaned up.

share|improve this answer
    
It's indeed a nice workflow. :) –  Paulo Cereda Aug 18 '12 at 0:52

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.