[Tex/LaTex] Using LaTeX to serve web requests in enterprise

compilingmiktexonlinepdftex

I am looking for a solution to generate pdfs dynamically and serve the web requests. I have a couple of questions:

  • Would it be a good solution to use LaTeX if I get input from web,
    fill LaTeX sources, generate pdf and return a link to the pdf?

As far as the amount of such request may go up to 10K a day, I am worrying about load, concurrency, scaleability issues. So,

  • Does anyone know the limits/boudaries for TeX compilers and pdf
    generators? Or suggest any to use in my case?

PS. The reason why I chose LaTeX is that documents to be generated have lots of rules such as formating, section alignments, margins, floats, etc…

Best Answer

Yes, you can do that. However, remember that it's not going to be a simple task. I'll first try to point out some general facts:

  • You wouldn't be the first one doing that, others include:

    • arXiv.org
    • many journals, who let authors submit the articles in TeX and typeset them on the server
    • writeLaTeX and shareLaTeX and similar services
    • me using it for PHP&MySQL-driven data visualization (score charts and score tables, meeting schedules and such)
  • Especially the last example above shows that people can use it without any LaTeX knowledge (I made the system, other colaborators have no idea what LaTeX is).

Then, excuse me for that, but I think that possible issues and things needed to solve should be pointed out:

  1. The amount of 10000 a day is really really a lot! If the compilation took 8 seconds per document, it would be 80000 seconds, which is the full day! And 8 seconds per document is quite possible. Get a very good hardware for that all. From my point of view: a lot of memory, so that the whole LaTeX distro can be pre-cached, or installation on an hybrid drive, with LaTeX distro being on the SSD part of course.

  2. If the data is not filled "from inside LaTeX", you have to cleverly and clearly take care of the input transformation, I mean: special characters, correct formatting, etc. It's a bit more difficult that how it looks at the first sight.

  3. Big problem is if you don't solve some situation correctly and error messages appear during the LaTeX compilation, users will simply have to wait until you come and see what's going on.

  4. You need the correct access to the services from within the web server environment. I mean, if it's in PHP, you can only call LaTeX using exec(), which is quite frowned upon by many sysadmins for its risks. Surely you should create a seperate user account just for this stuff on your (I suppose UNIX) server.

Related Question