'how to give password protection in jspdf package?

I'm using JSPDF for creating a PDF file but I cant give password protection on it. how to create password protected pdf with jspdf package in react?



Solution 1:[1]

Current have no way set password with jspdf. Use node-qpdf package to make your pdf be protected.

var qpdf = require('node-qpdf');

var options = {
    keyLength: 128,
    password: 'YOUR_PASSWORD_TO_ENCRYPT'
}

qpdf.encrypt(localFilePath, options);

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 VMT