MathML to Image (like JEuclid) that works on GAE

492 views Asked by At

I was wondering if somebody succeeded in transforming from MathML expressions into images in GAE.

GAE imposes many limitations on the classes allowed (bye bye FOP/ JEUclid) and I cannot do the logic in the front-end (mathjax) since the target is to print a pdf.

So far I contemplate either changing PaaS or switching to managed vm in GAE but it seems rather overkill.

Thanks

1

There are 1 answers

2
Igor Artamonov On

I have such experience, with processing math formulas and generating a PDF. It took a time, but I managed to do that on Appengine. I tried most of know libraries, including FOP, none of them works on gae, of course.

What I'm using:

  • mathtex.cgi for math render. It can generate an image through HTTP call, just pass formula in request, and get a PNG. I've installed on separate server (I already had this server, very basic one, for wordpress and stuff, so that was not a problem). Also you could find few public servers with mathtex.cgi, including official one, that you can use w/o having own server
  • appengine-itext for PDF. It have some minor issues, but mostly works. To put formulas into PDF I've following hack: a simple regex replaces math code with a <img> tag that points to a dummy protocol math://, then I have a custom ImageProvider that renders formula by using MathTex for such urls
  • for browser clients MathJax works fine

Little bit hacky, and requires a cheap external server, but that works