pdffillerjs / pdffiller

Take an existing PDF Form and data and PDF Filler will create a new PDF with all given fields populated.
MIT License
286 stars 113 forks source link

exec error: Error: spawn pdftk ENOENT #71

Closed dldereklee closed 6 years ago

dldereklee commented 6 years ago

Trying to run the generateFDFTemplate function, but I keep getting: exec error: Error: spawn pdftk ENOENT

I found a couple forum responses that say to install pdftk, but I already installed pdftk by using: npm install pdftk --save

Here is my function that I am trying to execute. The test.pdf is the one from the repo:

var template = (path) => {
  var pdfFiller   = require('pdffiller');
  // Override the default field name regex. Default: /FieldName: ([^\n]*)/
  var nameRegex = null;

  var FDF_data = pdfFiller.generateFDFTemplate(path, nameRegex, function(err, fdfData) {
      if (err) throw err;
      console.log(fdfData);
  });
}
template('test.pdf')

Any help is much appreciated

dldereklee commented 6 years ago

Needed to use installer from this Stack Overflow post. Now it works. https://stackoverflow.com/questions/32505951/pdftk-server-on-os-x-10-11/33248310#33248310