Skip to content
Advertisement

Compiling Latex with Javascript

I am working on a webapp(written with react-js) that generates a Latex code which contains information to give to the user. My goal is to let the user download the PDF file directly from my application.

I first tried using this library: texlive.js, that seemed to work but really it’s impossible to recompile(their “Makefile” is not meant to handle new packages) if you try to add new packages(only some basic ones work).

So I thought about using the overleaf APIs but they don’t let you obtain the pdf without sending the user to their website.

Any advice to make one of them work or any other way to achieve my goal?

Advertisement

Answer

I’ve recently found this project: https://github.com/SwiftLaTeX/SwiftLaTeX

I’ve tested it with a few documents and it seems to work. It downloads the needed packages from the web, see available packages: https://www.ctan.org/. I haven’t gone deeper into passing images to the engine but it should be possible. See the official demo: https://www.swiftlatex.com/#demo

Here is the official guide with the download link for the already compiled wasm files and with the js bindings: https://www.swiftlatex.com/#install

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement