Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PDF to image on Node JS [closed]

Anyone know of any good libs for NodeJS or even an API to create images out of PDF pages?

like image 406
Mark Nguyen Avatar asked Nov 05 '22 11:11

Mark Nguyen


1 Answers

I think the solution should use external program like ghostscript to build your jpg from.

var exec = require('child_process').exec;

exec('gs -dNOPAUSE -sDEVICE=jpeg -r144 -sOutputFile=p%03d.jpg file.pdf' , function(err) {
    if (err) {
        // something went wrong
    } else {
       // everything went good do something after the process is completed
    }
});
like image 185
malletjo Avatar answered Nov 09 '22 15:11

malletjo