node-pdftk icon indicating copy to clipboard operation
node-pdftk copied to clipboard

pdftk installed but showing as uninstalled

Open SiriSuri opened this issue 4 years ago • 5 comments

const pdftk = require('node-pdftk'); pdftk.configure({ bin: 'C:/Program Files (x86)/PDFtk Server/bin', Promise: require('bluebird'), ignoreWarnings: true, });

pdftk .input([textfile, change,log]) .output() .then(buf => { let path = './merged.pdf'; fs.open(path, 'w', function (err, fd) { fs.write(fd, buf, 0, buf.length, null, function (err) { fs.close(fd, function () { console.log('wrote the file successfully'); }); }); }); });

This is my code. But the error i am getting is : pdftk was called but is not installed on your system.

I installed both pdftk and pdftk server. I set the pdftk_path variable to 'C:/Program Files (x86)/PDFtk Server/bin', in my environment variables too.

I configured the same through options. But still i am getting the error.

Please help me

SiriSuri avatar Aug 07 '20 17:08 SiriSuri

@SiriSuri which version of node js are you using? Please use three times ` sign to mark source code for better readability.

gustawdaniel avatar Nov 08 '20 09:11 gustawdaniel

I'm having the exact same problem. My node version is v12.18.4

p-ribeiro avatar Feb 10 '21 14:02 p-ribeiro

Solved... I did my configure like this: pdfTk.configure({ bin: "C:/Program Files (x86)/PDFtk Server/bin/pdftk.exe", Promise: require('bluebird'), ignoreWarnings: true, tempDir: path2.join(__dirname,'../../test') });

p-ribeiro avatar Feb 10 '21 14:02 p-ribeiro

In my Linux Ubuntu I just run snap install pdftk. It magically did the fix.

ae-daenchrisarmada avatar Mar 09 '23 18:03 ae-daenchrisarmada

I am confirming. In my build I am using

pacman -Sy pdftk

We can close this issue with link:

https://command-not-found.com/pdftk

gustawdaniel avatar Mar 10 '23 03:03 gustawdaniel