2

I am looking for a solution where i can use java-script to rotate an existing PDF. I tried many things but could not find anything. i am not sure if PDF.JS or jsPDF.js can help me, i tried to figure out but was not very successful. But doing the same thing with Java was quick. But this will not work for me because then i cannot call .class file or .Bat file with parameter using java-script. Can anyone suggest some solution?

var execFile = require('child_process').execFile,
  child;
child = execFile('C:\\WorkLog\\Software\\run.bat',
  //child = execFile('C:\\PDFRotation\\Run.bat',
  function(error, stdout, stderr) {
    if (error) {
      console.log(error.stack);
      console.log('Error code: ' + error.code);
      console.log('Signal received: ' + error.signal);
    }
    console.log('Child Process stdout: ' + stdout);
    console.log('Child Process stderr: ' + stderr);
  });
child.on('exit', function(code) {
  console.log('Child process exited ' + 'with exit code ' + code);
});
LarsBauer
  • 1,539
  • 18
  • 23
karan
  • 71
  • 7
  • 2
    You can use [scissors](https://www.npmjs.com/package/scissors). For instance, `var scissors = require('scissors'); var pdfToRotate = scissors('fileIn.pdf').rotate(90);`. Finally, output data as streams: `pdfToRotate.pdfStream().pipe(fs.createWriteStream('fileOut.pdf'));`. – Matthias A. Eckhart Jul 21 '15 at 13:52
  • Thank you @MatthiasEckhart but for scissors we need ofPDFtk, i am looking for something more independent. Please correct me if i wrong. – karan Jul 21 '15 at 19:51

0 Answers0