I'm new to node.js but I think It could be good for an asynchronous latex compile engine.
In other words I'd like to know if could be possible, and how, to compile a document via node.js and pdflatex. The remote application would send the document as a JSON data structure, toghether with a template name for the end document layout.
The node.js will handle the compilation in pdf, taking the template from the file system.
Do you know if something similar, already exist?
In order to compile a LaTeX file, simply press \ll while editing the file. This runs latex on the current file and displays the errors in a |quickfix-window| below the file being edited.
Two of the most commonly used packages used to compile JavaScript files into executables are: nexe: It is a simple command-line utility that compiles your Node. js application into a single executable file. By default, it converts it into a Windows executable.
You can spawn own child processes and thus also start latex processing. By registering appropriate listeners, you can detect the process completition or failure output:
var sys = require('sys'),
spawn = require('child_process').spawn,
pdflatex = spawn('pdflatex', ['-output-directory', '/target/dir/','input.tex']);
pdflatex.on('exit', function (code) {
console.log('child process exited with code ' + code);
});
EDIT: For creating the intermediary latex file using the provided data, I'd suggest to use a node.js template engine like mu/mustache.
So you could then pump the chunks of the template engine process as stdin to your spawned pdflatex process.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With