pdfServer runs as a print server for LaTeX files. It is written in 165 lines of Haskell code using the Scotty web server library.
The server accepts POST requests at /pdf/ with payload a record containing a document id, a title, and the contents of a LaTeX file.
Upon receipt of such a request, the server runs xelatex on the LaTeX file, after which GET requests to /pdf/:id will return a link the corresponding PDF file.
These days the id is a normalized version of the document title. Thus "Introduction to Quantum Mechanics" will have "introduction-to-quantum-mechanics.tex" as id.
{"id": "test-document.tex", "title": "Test Document", "content": "\\documentclass{article}\n\\begin{document}\n$a^2 + b^2 = c^2$\n\\end{document}\n"}
POST requests to /tar/ with the same payload as to /pdf/ will generate a tar archive with contents the LaTeX document and a subfolder "image" with a copy of each of the image files found in the document. After processing, GET requests to /tar/:id will return a copy of the tar archive.
stack run
Test if the server is up with http://localhost:3000/hello
Do not use https
on localhost!!
The server is installed as http://pdfServ.app
at
my DigitalOcean "rose" box in ./pdfServer
To update the server:
git pull
if need bestack build
stack ghc app/Main.hs, mv app/Main pdfServer
reboot
stack install MissingH
is neededhoogle