forked from oschrenk/node-pdflatex
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpdflatex.js
More file actions
31 lines (27 loc) · 696 Bytes
/
pdflatex.js
File metadata and controls
31 lines (27 loc) · 696 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
var util = require('util');
var path = require('path');
var fs = require('fs');
var exec = require('child_process').exec;
/*
PDFLatex class
*/
// constructor
function PDFLatex(inputPath) {
// default settings
this.outputDirectory = process.cwd() + "/";
this.inputPath = inputPath;
};
PDFLatex.prototype.outputDir = function(path) {
this.outputDirectory = path;
return this;
};
PDFLatex.prototype.process = function() {
if (this.inputPath && this.inputPath.length > 0) {
var command = "pdflatex -output-directory " + this.outputDirectory + " '" + this.inputPath + "'";
util.puts(command);
exec(command, function(err) {
if (err) throw err;
});
}
};
module.exports = PDFLatex;