Reputation: 13462
I'm currently using this code to just get an alert in the print dialog box
(function() {
var beforePrint = function() {
alert('Functionality to run before printing.');
};
var afterPrint = function() {
alert('Functionality to run after printing');
};
if (window.matchMedia) {
var mediaQueryList = window.matchMedia('print');
mediaQueryList.addListener(function(mql) {
if (mql.matches) {
beforePrint();
} else {
afterPrint();
}
});
}
window.onbeforeprint = beforePrint;
window.onafterprint = afterPrint;
}());
Everything works, I get an alert before and after the print dialog box shows.
Now my problem is, or what I wanted to do, is to automatically secure saved pdf with passwords like I will set a random password in the script and the pdf will automatically be secured with that password.
Is that even possible? Thank you in advance.
Upvotes: 0
Views: 2033
Reputation: 2878
It is not possible to secure PDF using client side javascript. Your options are:
Upvotes: 1