Thursday 13 April 2017

JSON to (LaTeX) PDF as a NPM package?

I'm looking for a solution for the following problem:I have JSON data.I want to pass this to a NPM package (that I'm making) that will take the data (and a stream) and result in a PDF generated from the data (on the stream).The resultant PDF needs to be quite detailed; I've looked into some packages that do this directly and found they lack the level of detail needed.For reference, the resultant PDFs are going to be a (less graphical) version of this. The ability to flow text over two-columns is a huge plus, but if you have a solution that only works for one column I'd consider it.My initial thought is to use LaTeX as an intermediate package, creating a TeX stream that is passed to a LaTeX engine and piping the result to the output stream.The bit that's causing me issue is finding a decent "TeX to PDF" engine that:Can be run in NodeHas no other dependencies other than what comes with the package (e.g. some are simple wrappers around CLI commands, which requires they be available in your system).Is able to handle varied input data (i.e. can smartly deal with wrapping columns/pages).Anyone had any luck with this before? Packages I've looked at but drawn a blank on because either lack of features, extra dependencies, or simply not getting how it works:node-latex - simple wrapper around the CLIpdftex.js - uses Emscripten, something I am not familiar or comfortable with. If this is viable for use in an NPM package please do point me at how to go about using it.texlive.js - as per pdftex.js, seems to be roughly the same sort of thing but wrapped differently.If you've got a non-LaTeX solution that supports what I need, definitely shout it out as well! pdfkit doesn't seem to have what I need without making my own layers on top to make rendering text properly not a huge chore. If that's what I need to do then I'll do it, I just want to get on with the project rather than the infrastructure around it.

Submitted April 13, 2017 at 06:13AM by Tidher

No comments:

Post a Comment