
Adobe Acrobat SDK
Working with Acrobat Extended APIs
Developing Plug-ins and Applications
Creating and destroying consultants 224
The consultant defines the following methods for HFT usage:
●
ConsultantCreate
●
ConsultantDestroy
●
ConsultantTraverseFrom
●
ConsultantRegisterAgent
●
ConsultantSetStart
●
ConsultantNextObj
●
ConsultantGetPercentDone
●
ConsultantGetNumDirectVisited
●
ConsultantGetNumIndirectVisited
●
ConsultantSuspend
●
ConsultantResume
●
ConsStackGetCount
●
ConsStackIndexGetObj
●
ConsStackIndexGetTypeCount
●
ConsStackIndexGetTypeAt
●
ConsStackIndexIsDict
●
ConsStackIndexIsArray
●
ConsStackIndexGetDictKey
●
ConsStackIndexGetArrayIndex
●
PDFObjTypeGetSuperclass
●
ConsultantGetNumUniqueIndirectsVisited
Creating and destroying consultants
The consultant’s HFT allows you to create a consultant for your own use. Once you have finished writing
your agent class, you are ready to register it with the consultant and begin processing documents. You
should keep your agent separate from the consultant object—that is, do not make the consultant object a
member of your agent class. Use a plug-in as the owner for both the consultant and your agent object.
Because there is some memory overhead in creating a consultant, you should only create a
Consultant
object when it is required, not before. If your target application is a plug-in, the most logical place to
perform all operations is in the menu item execute procedure. Whether or not it makes sense to destroy
the
Consultant
object after each execution of the menu item depends on your project.
The consultant HFT provides the functions
ConsultantCreate
and
ConsultantDestroy
, for creating
and destroying
Consultant
objects. It also provides the Consultant data type, an opaque type for
passing handles to
Consultant
objects. The
ConsultantCreate
method returns variables of that type
and requires them as parameters to all other HFT functions having the
Consultant
prefix.
After each run the consultant unregisters all the agents that were registered with it; however the memory
for the
Consultant
object itself remains, and the object must be explicitly destroyed to free the memory.
Depending on the duties you assign your consultant, you may want to destroy it after each execution of
the menu item that launches it, or you may wish to keep it running.