Closed letalumil closed 6 years ago
I have the same error. No output file. And no error.
Hi @GautierT and @letalumil, thanks for your feedback I will work on that on the weekend and hope to release new version that solve the problem. To test I will use the sample ps file posted by @letalumil.
Hi @letalumil and @GautierT , I replicated your problems and for now I found this solution:
const gs = require('ghostscript4js')
let cmd = '-psconv -q -dNOPAUSE -sDEVICE=pdfwrite -o out.pdf -f in.ps'
try {
gs.executeSync(cmd)
} catch (err) {
console.log('Error => ', err)
}
It worked for me, please try it and send me feedback.
Hi @NickNaso, I just tried the modified command and it works well now.
Thank you for the quick help!
Works for me too
let cmd = `-psconv -q -dNOPAUSE -sDEVICE=pdfwrite -o ${file_path_repair} -dPDFSETTINGS=/prepress ${file_path}`
const result = await gs.execute(cmd)
Hi @letalumil and @letalumil , good to hear. So next days I will provide to close the issue. Have a nice day.
@NickNaso so it appears that switch -sOutputFile doesn't work with ghostscript4js. At least I don't see an output although stdout appears to iterate the pages. That said the above examples did output the file. Is my description accurate or is there something I'm missing. Also would would be the suggestion as to monitoring progress. Say percentage of completion. Maybe getting page count first then counting the ticks (each page) or something? Speaking to compression or any process which iterates each page.
Hello! Thanks for the great package, it looks promising, but something doesn't work well in my case.
I'm trying to convert a PostScript file to PDF via the following command:
-sDEVICE=pdfwrite -o out.pdf -f in.ps
. So, nothing fancy, all params are the default.If I execute it in shell directly this way:
gs -sDEVICE=pdfwrite -o out.pdf -f in.ps
, then everything works well and theout.pdf
is placed next to thein.ps
.But when I try to use the very same command with
ghostscript4js
, then I get no PDF file and no error. Here is the code I use:And here is the console output:
I tried the sample code with the PNG file from the readme and it works well. It seems to be something specific with the pdfwrite. If you have any suggestions I'd much appreciate it! Thanks!
Here is some info about my environment:
OS: macOS 10.12.6 Node: v8.4.0 (I also tried with node v6) Ghostscript: 9.21 Sample PostScript file I used: link (I also tried a bunch of other ps files, but no luck)