Skip to main content
Participant
July 31, 2024
Question

Eventhandlers for page loading events of IDML document opening

  • July 31, 2024
  • 1 reply
  • 290 views

I'm opening an IDML document using ExtendScript. I want to register events for all the page loading events at the time of document opening.

I'm getting document specific events e.g. "beforeNew", "beforeOpen", "afterNew", "afterOpen" etc but i'm not able to get EventListeners for events related Pages, PagesItems etc.

Can you please suggest what is the best way to register and get events for pages specific events during document opening in the ExtendScript ?

 

My main objective is to apply specific MasterPages to the pages being loaded at the time of document opening. Later i intend to adjust the Widths of all the inlined items of a story as per the width of the MasterPage applied.

 

Any pointers or suggestions will be much appreciated.

 

This topic has been closed for replies.

1 reply

Community Expert
July 31, 2024

I don't see any events exposed for Page, for pageItems we have two events i.e. afterPlace and beforePlace. For your use case I don't see a need for page and pageItem specific events. Why don't you add an eventlistener on an event like afterOpen and then do the changes of the master page and pageitems in this event handler?

-Manan

-Manan
Participant
July 31, 2024

Thanks Manan for replying. I also tried registering these two events.

 

  • When i registered it with the document element then i did not get the events 
app.documents.everyItem().addEventListener("beforeUpdate",...
  •  When i registered these event with pageItems then i got the error that addeventhandlers function is not available with these objects
doc.pages.everyItem().pageItems.everyItem().addEventListener("beforeUpdate",...