Closed waynellin closed 5 years ago
Here is a working example using the callback argument:
var options = {
keyLength: 40,
password: 'STRONG'
};
qpdf.encrypt('./sample.pdf', options, function(err, data) {
if (err) {
console.log(err);
} else {
const writeStream = fs.createWriteStream('./secured.pdf');
data.pipe(writeStream);
}
});
qpdf.encrypt(localFilePath, options, outputFilePath); and qpdf.decrypt(localFilePath, 'YOUR_PASSWORD_TO_DECRYPT_PDF', outputFilePath); requires callback for outputFilePath. Where do we actually provide the string for output location? and what's an example for the callback function?