Binding the handler to `window` might not be a good idea, note that the output of pdf2htmlEX is supposed to be embedded into another page, and there might be multiple documents in a same page.

On the other hand, I just realized that I don't know how to fix this without binding an event to `window`, it's a dilemma to me.