PHP LaTeX to PDF Conversion/Compiling [closed]

允我心安 提交于 2019-11-29 19:04:29

问题


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.


回答1:


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.




回答2:


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...




回答3:


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!