node-pdftk
node-pdftk copied to clipboard
pdftk installed but showing as uninstalled
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 which version of node js are you using? Please use three times ` sign to mark source code for better readability.
I'm having the exact same problem. My node version is v12.18.4
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') });
In my Linux Ubuntu I just run snap install pdftk
. It magically did the fix.
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