Compile LaTeX code to PDF
Content-Type: application/pdf PDF file binary data
{
"error": "Compilation failed",
"log": "LaTeX error log details..."
}
Serve the web frontend interface
Display this API documentation
curl -X POST http://localhost:7860/compile \
-H "Content-Type: application/json" \
-d '{"code": "\\documentclass{article}\\begin{document}Hello\\end{document}"}' \
--output output.pdf
curl -X POST http://localhost:7860/compile \ -F "file=@document.tex" \ --output output.pdf
import requests
latex_code = r"""
\documentclass{article}
\begin{document}
Hello from Python!
\end{document}
"""
response = requests.post(
'http://localhost:7860/compile',
json={'code': latex_code}
)
if response.status_code == 200:
with open('output.pdf', 'wb') as f:
f.write(response.content)
else:
print(response.json())