How to convert LaTeX to PDF/PNG by PHP

孤人 提交于 2019-12-24 18:06:22

问题


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

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