Is there a Hook that determines that the AJAX response has already been sent to the client

Good morning.

I am currently developing a plugin that during the publication edition launches a function whose task is to make the user download a PDF file.
I register the Hook: "HookRegistry::register(‘Publication::edit’,…) and when I finish the function then I have to send the appropriate headers to the client browser so that the PDF can be downloaded. The problem comes because the client is waiting for a JSON response after an AJAX request. My question is, is there a Hook that determines that the AJAX response has already been sent to the client, so that I can send the client browser new headers?

I’m under the OJS 3.3.0.8 version

Thank you
Carlos Martínez

Hi @faedpyme,

Have you already looked at the part of the documentation for developers regarding controllers/handlers: Handlers - Technical Documentation - OJS|OMP|OPS and scheme on request lifecycle in OJS: Request Lifecycle - Technical Documentation - OJS|OMP|OPS?
Have you determined the behavior of which handler you want to modify?