tabula.js spawns a process call to java (via java -jar) to run tabula-extractor. It emits the stdout (extracted csv) and stderr (warnings and errors) as data and error events. It also emits a close event with exitCode.
var Tabula = require('tabulajs');
var tabula = new Tabula();
tabula.on('data', function(data) {
console.log(data);
});
tabula.on('error', function(err) {
console.log(err.toString());
});
tabula.on('close', function(exitCode) {
console.log(exitCode);
});
tabula.convertPdfToCsv(input);
Run npm install
then make test
from the root of the repository to run the mocha unit tests.
See tabula-extractor for the original from which this is obtained. A jar is made from this git repository by bundling the files.
To make the jar file, have jruby installed. Then clone tabula-extractor and run the following commands from the root of the git repo:
jruby -S gem install bundler
jruby -S gem install warbler
jruby -S bundle install
jruby -S warble
This should produce the jar tabula-extractor.jar (located in lib/
).