I state that I have never used the pdf and neither those functions, but if I understand correctly you will need to handle an event, then the best solution is to create a class (an object from a class), which will contain and provide the pdfs and will be able to handle events.