问题
I have LaTeX
code inside PHP (not as .tex file); for example received by $_POST. How can I save the rendered LaTeX
as a PNG or PDF file on my server?
EDIT: I know that PHP normally does not do this. I will run a shell command within PHP. Thus, I need something to do so in Linux terminal.
回答1:
you could exec() pdfTex to generate a PDF
URL: http://www.tug.org/applications/pdftex/
Run command
pdftex file.tex
after you saved your tex-code from $_POST to a file using file_put_contents() - make sure you have the rights to write in the specified folder.
hope that helps!
来源:https://stackoverflow.com/questions/9464774/how-to-convert-latex-to-pdf-png-by-php