1
0
Fork 0
mirror of https://github.com/Luzifer/tex-api.git synced 2024-11-08 16:20:04 +00:00
tex-api is a docker container being able to generate a PDF document from a LaTeX file and additional assets using a simple curl call.
Find a file
Knut Ahlers de468be22a
Improve error handling
Signed-off-by: Knut Ahlers <knut@ahlers.me>
2018-09-17 12:01:29 +02:00
vendor Update imports 2018-09-17 11:55:08 +02:00
.gitignore Move builders to own file 2017-03-06 21:59:53 +01:00
assets.go Update imports 2018-09-17 11:55:08 +02:00
CONTRIBUTING.md Add meta files 2017-03-05 13:25:01 +01:00
Dockerfile Migrate to Alpine as the base image 2018-09-17 11:31:18 +02:00
Gopkg.lock Update imports 2018-09-17 11:55:08 +02:00
Gopkg.toml Update imports 2018-09-17 11:55:08 +02:00
History.md prepare release v0.1.0 2018-09-17 11:47:09 +02:00
LICENSE Update meta-files 2018-09-17 11:33:46 +02:00
main.go Improve error handling 2018-09-17 12:01:29 +02:00
Makefile Add tests 2017-03-06 09:41:58 +01:00
README.md Update meta-files 2018-09-17 11:33:46 +02:00
tex-build.sh Simplify script 2018-09-17 11:14:18 +02:00

Go Report Card

Luzifer / tex-api

tex-api is a docker container being able to generate a PDF document from a LaTeX file and additional assets using a simple curl call.

Usage

  • Start the container at a trusted location:
    docker run -d -p 3000:3000 -v /data/tex-api:/storage quay.io/luzifer/tex-api
  • Compile a ZIP file, send it to the API and get the result:
# zip -r letter.zip fonts main.tex sig.jpeg
  adding: fonts/ (stored 0%)
  adding: fonts/Roboto-Black.ttf (deflated 46%)
  adding: fonts/Roboto-BlackItalic.ttf (deflated 46%)
  adding: fonts/Roboto-Bold.ttf (deflated 47%)
  adding: fonts/Roboto-BoldItalic.ttf (deflated 45%)
  adding: fonts/Roboto-Italic.ttf (deflated 47%)
  adding: fonts/Roboto-Light.ttf (deflated 47%)
  adding: fonts/Roboto-LightItalic.ttf (deflated 47%)
  adding: fonts/Roboto-Medium.ttf (deflated 46%)
  adding: fonts/Roboto-MediumItalic.ttf (deflated 46%)
  adding: fonts/Roboto-Regular.ttf (deflated 46%)
  adding: fonts/Roboto-Thin.ttf (deflated 44%)
  adding: fonts/Roboto-ThinItalic.ttf (deflated 42%)
  adding: fonts/RobotoMono-Bold.ttf (deflated 41%)
  adding: fonts/RobotoMono-BoldItalic.ttf (deflated 40%)
  adding: fonts/RobotoMono-Italic.ttf (deflated 39%)
  adding: fonts/RobotoMono-Light.ttf (deflated 42%)
  adding: fonts/RobotoMono-LightItalic.ttf (deflated 41%)
  adding: fonts/RobotoMono-Medium.ttf (deflated 41%)
  adding: fonts/RobotoMono-MediumItalic.ttf (deflated 40%)
  adding: fonts/RobotoMono-Regular.ttf (deflated 41%)
  adding: fonts/RobotoMono-Thin.ttf (deflated 41%)
  adding: fonts/RobotoMono-ThinItalic.ttf (deflated 40%)
  adding: main.tex (deflated 58%)
  adding: sig.jpeg (deflated 3%)

# curl -sSL -H 'Accept: application/tar' --data-binary @letter.zip localhost:3000/job | tar -xvf -
main.log
main.pdf

What happened here is we packed all assets required for generating the letter into the ZIP archive, pushed it to the API, waited for it to build a TAR and extracted the resulting files from it.

API

POST  /job                  Create a new processing job (request body is expected
                            to be a ZIP file having at least one .tex file at the
                            root of the archive) and redirect to the /wait endpoint
GET   /job/{uuid}           Retrieve the status of the processing job
GET   /job/{uuid}/wait      Wait and redirect until the processing job is finished
                            or errored
GET   /job/{uuid}/download  Download the resulting archive (You may specify an
                            Accept header to select whether to receive a ZIP or
                            TAR archive.)