I have searched far and wide to find a PHP-based tool to convert LaTeX to PDF, but have had no success. I understand that LaTeX runs on the server side, however I still require a PHP-based command process in order to generate said PDF files using LaTeX.
Edit
Additionally, installing binaries, libraries or tools on to the server is a no-no. The tool at my disposal is PHP and the functionalities it has built in. Any class or PHP tool that can convert LaTex to PDF is incredibly useful.
Any guidance would be most appreciated.
i just installed the package texlive-binaries
and used a shell exec with the pdflatex
command to generate the PDF from a (La)TeX file:
shell_exec("/usr/bin/pdflatex --interaction batchmode $filename");
i know this is not what you asked for but i don't know of a php lib as complete as the already existing latex compilers.
why reinvent the wheel anyways?
Update: When you have enough space, install textlive-full
instead of texlive-binaries
. This will install all the available packages, fonts, etc. and avoid you some headache why your document renders wrong.
If you can't change your server setup to install server package for LaTeX you can't convert LaTeX files them into PDF...
but what you could check to convert directly into PDF without LaTeX, but that depends what you like to accomplish? It might be a look worth...fpdf...
that is my example: name: phplatex.php
<?php
$data = shell_exec('/Library/TeX/texbin/pdflatex --interaction=nonstopmode -output-directory=/Users/arico/a/destino /Users/arico/a/fuente/prueba.tex');
echo ('Latex: ' . $data . '');
?>
path of pdflatex executable: /Library/TeX/texbin/pdflatex
path of output file in pdf: (you need permissions to write) -output-directory=/Users/arico/a/destino
path of source file in latex: /Users/arico/a/fuente/prueba.tex
来源:https://stackoverflow.com/questions/8577244/php-latex-to-pdf-conversion-compiling