Skip to content

piti118/latex-json-report

Repository files navigation

Latex Report Server

A flask blueprint based server that accepts json, render it on latex template and compile it and send back the pdf.

Author

Piti Ongmongkolkul

License

Public Domain

Requirements

  • Python 3.5+. We need this for a sensible subprocess module. Not just 3 but 3.5.
  • All other stuff in requirements.txt
  • xelatex (Texlive should work in most cases)

TLDR;

Making a New Template

  • See templates/ for examples.
  • The template engine is a customized jinja2. See latex_jinja.py for the full syntax.
    • Basic ones are
      • Variable ((( varname )))
      • Block ((* for x in l *))
  • The format is copied from http://flask.pocoo.org/snippets/55/ . The choice is intended so that the template is self is a valid tex document so one can use latex editor to edit it.

Making a New Blueprint

  • use blueprint.make_blueprint(name, templatemodule)
  • See app.py for example

Helper

  • To help develop the template the script test_template.py is provided.
  • The script will try to the template module provided and put it in tmp

Docker

The docker file is provided. The tex-live there is a small one. A lot of package and fonts are not installed by default. If your file doesn't compile this might be the reason.

	docker run -p 5000:5000 .

Todo

  • make it a pypi package the only method needed to export is really blueprint.make_blueprint

About

Report server with json post and xelatex

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published