I'm using chrome version 109.0.5414.75 and developping an extension. And when I call print() method to save a page as pdf file, I can't catch afterprint event. But when I type Ctrl+P commnad then the event fired and after this, print() method fire afterprint event normaly.
The code is in content.js of developping extension.
The code is very simple in content.js
window.addEventListener('afterprint', (event) => {console.log('After printing'); });
When I save as pdf by print() from console of developer tool, the event not fired. but by Ctrl+P if fired.
This situation happens an environment but on other systems no problem(fire the event). Does someone have some ideas to solve this?
I can use eventdispatch to deal with it, but I want the timing that saved pdf(afterpring).