
Adobe Acrobat SDK
Creating Handlers
Developing Plug-ins and Applications
Exposing AVCommands to the batch framework 144
ASTextSetEncoded(text, docTitleValue,(ASHostEncoding)PDGetHostEncoding());
ASCabPutText (params, docTitleValue, text);
//Clear the ASText object
text = ASTextNew();
ASTextSetEncoded(text, docSubjectValue,(ASHostEncoding)PDGetHostEncoding());
ASCabPutText(params, docSubjectValue, text);
//Invoke the command
AVCommandExecute(cmd);
}
static ACCB1 AVCommandStatus ACCB2 DoWorkImpl (AVCommand cmd)
{
AVAlertNote("The DoWorkImpl method was invoked");
return kAVCommandDone;
}
Exposing AVCommands to the batch framework
Acrobat or Adobe Reader builds the list of commands that users see in the
Batch Sequences
and
Batch Edit Sequence
dialog boxes from an internal list of
AVCommands
referred to as the global
command list.
Adding a handler to the global command list
To expose a command to the batch framework, the
AVCommand
handler must first add an instance of the
command to this global list by invoking the
AVAppRegisterGlobalCommand
method.
AVCommand cmd = AVCommandNew(ASAtomFromString(kCmdName));
AVAppRegisterGlobalCommand(cmd);
Although this step can be performed at any time once the command handler is registered, handlers
commonly register commands from within the
AVCommandRegisterCommandsProc
callback (of the
AVCommandHandlerRec
structure).
Supporting properties
When building a list of batchable commands, Adobe Reader or Acrobat iterates through its internal
command list, querying each command for the
CanBatch
and
GroupTitle
properties. To be exposed
through the batch framework user interface, a command must support these properties (that is, return
true
and a valid
ASText
object, respectively). The
AVCommand
handler must implement the
GetProps
callback of the
AVCommandHandlerRec
structure.
If an
AVCommand
supports these properties, Adobe Reader or Acrobat queries a number of additional
properties as the user interacts with the batch framework. Of these additional properties, only two are
required:
Title
and
Generic Title
. A command must provide the title strings that will be displayed in
the Batch Sequences and Batch Edit Sequence dialog boxes.