Copy link to clipboard
Copied
I wanted to register eventhandlers for all the page loading events whenever an IDML document is opened in the InDesign Server application.
I tried registering event handlers using ExtendScript but it didnt worked out. I got only document specific events e.g. beforeNew, beforeOpen, afterNew, afterOpen etc.
So, I want to achieve this using C++ PlugIns functionality in the InDesign Server application. Please let me know of any pointers which I can refer to create the plugIn for InDesign Server and register eventhandlers for page loading events. I could not find any specific sample code in the PlugIns SDK Kit relative to event handlers.
Copy link to clipboard
Copied
Hm, not sure about how you'd specifically detect opening an IDML doc. But to see how to respond to document events, there are a few ways but the easiest is a document responder. See the `DocWatch` sample plug-in, specifically the `kDocWchResponderServiceBoss` boss and the `kDocWchResponderImpl` on that boss, which is implemented in `DocWchResponder.cpp`. You could try looking at the before open doc signal and querying the document name to see if the extension is .idml. That's not a foolproof way (there can easily be IDML files without the ".idml" file extension, especially on Mac) but better than nothing. On Mac, you could also look at the file type to try to catch that case.
If you're interested in firing events back to scripting, see the `SnpHelloCSXS.cpp` snippet. That shows how to send a message from C++ that can be caught in the scripting interface.
Copy link to clipboard
Copied
As mentioned by @Lawrence Horwitz , refer DocWatch Sample i.e implement Document Responder.
Capture "kAfterNewDocSignalResponderService".
You will be able to access UIDRef of document.
On kDocBoss, refer interface IDocFileType from there you should be able to infer whether it is idml or not.
- Rahul Rastogi
Adobe InDesign C++ Custom Plugin Architect