I work with fancybox2, and I need to add some custom features before the PDF goes into the print queue. I need fancybox print callbacks (e.g. before printing, after printing). Can anyone help me? I tried window.print () callbacks, but they do not work in case of fancybox printing, following the pattern I used
$(function(){
var beforePrint = function() {
alert("BEfore print")
console.log('Functionality to run before printing.');
};
var afterPrint = function() {
console.log('Functionality to run after printing');
alert("After print")
};
if (window.matchMedia) {
var mediaQueryList = window.matchMedia('print');
console.log("Match media ..." + mediaQueryList)
mediaQueryList.addListener(function(mql) {
console.log("Mql matches ...."+ mql.matches)
if (mql.matches) {
beforePrint();
} else {
afterPrint();
}
});
}
window.onbeforeprint = beforePrint;
window.onafterprint = afterPrint;
}());
This does not work for fancybox printing, but it works when we try to print windows (for example, when we use ctrl + p). I need to handle callbacks when I click on the fancybox pdf print icon, look at the attached image
firefox, , firefox PDF, crhome, firefox pdf.

, Google, , fancybox embed pdf - (. ), firefox pdf, Adobe .. -, pdf trhough javascript