I have received a PDF from a server in which the user often wants to print without really looking at it. I try to use an onafterprint
event to close the window, however, it foes not seem to get triggered when I open a PDF this way. If I instead set the URL blank to open an empty page it seems to work just fine.
let url = URL.createObjectURL(blob);
let printWindow = window.open(url);
printWindow.onafterprint = function(){
console.log("afterprint")
};