-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Description
hi,
great job... but how can i use this binari ?
i tried with https://github.com/sina-masnadi/node-gs
gs()
.batch()
.nopause()
.option('-r' + 50 * 2)
.option('-dDownScaleFactor=2')
.executablePath()
.device('png16m')
.output(tempNewPath)
.input(tempFilePath)
.exec( (err, stdout, stderr) =>{
if (!err) {
console.log('gs executed w/o error');
console.log('stdout', stdout);
console.log('stderr', stderr);
//resolve();
return true
} else {
console.log('gs error:', err);
//reject(err);
return false
}
});
but i have this error:
Error: spawn ../lambda-ghostscript/bin/gs ENOENT
at exports._errnoException (util.js:1020:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:197:32)
at onErrorNT (internal/child_process.js:376:16)
at _combinedTickCallback (internal/process/next_tick.js:80:11)
at process._tickDomainCallback (internal/process/next_tick.js:128:9)
I thought the problem was the gs module, so I tried calling the binary file directly with spawn
var path = require('path')
const { spawn } = require('child_process');
var opz = ["-dBATCH","-dNOPAUSE","-r100","-dDownScaleFactor=2","-sDEVICE=png16m","-sOutputFile=/tmp/1-Introduzione_2018.png","/dist/in.pdf"];
var nwDir = path.dirname(process.execPath);
var a = path.join(__dirname,"lambda-ghostscript","bin","gs")
spawn(a, opz).stdout.on("data", function(d) {
console.log(d);
});
BUT
Error: spawn c:\Users\Samir\Documents\GitHub\esempi\provaGs\lambda-ghostscript\bin\gs ENOENT
util.js:1024
at _errnoException (util.js:1024:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:192:19)
at onErrorNT (internal/child_process.js:374:16)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
at Function.Module.runMain (module.js:655:11)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3
what am I doing wrong?? thanks
Metadata
Metadata
Assignees
Labels
No labels