
Adobe Acrobat SDK
Creating Handlers
Developing Plug-ins and Applications
File format conversion handlers 145
Example 12.6
Exposing AVCommands to the batch framework
const char *kCmdTitle = "Command Title";
const char *kGroupTitle = "Group Title";
const char *kCmdGenericTitle = "Generic Title";
ASBool doItAll = false;
if (ASCabNumEntries(params) == 0)
doItAll = true;
if (doItAll || ASCabKnown (params, kAVCommandKeyGroupTitle))
{
// Create a new text object and insert it into the ASCab
text = ASTextNew();
ASTextSetEncoded (text, kGroupTitle, (
ASHostEncoding)PDGetHostEncoding());
ASCabPutText(params, kAVCommandKeyGroupTitle, text);
}
if (doItAll || ASCabKnown (params, kAVCommandKeyCanBatch))
ASCabPutBool (params, kAVCommandKeyCanBatch, true );
if (doItAll || ASCabKnown (params, kAVCommandKeyGenericTitle))
{
//Create a new text object and insert it into the ASCab
text = ASTextNew();
ASTextSetEncoded (text, kCmdGenericTitle,
(ASHostEncoding)PDGetHostEncoding());
ASCabPutText (params, kAVCommandKeyGenericTitle, text);
}
if (doItAll || ASCabKnown (params, kAVCommandKeyTitle))
{
// Create another text object and insert it into the ASCab
text = ASTextNew();
ASTextSetEncoded (text, kCmdTitle,
(ASHostEncoding)PDGetHostEncoding());
ASCabPutText (params, kAVCommandKeyTitle, text);
Note:
The
params
object was declared in
“Running an AVCommand” on page 143
.
File format conversion handlers
A plug-in can add file conversion handlers to Acrobat (but not Adobe Reader) for performing the following
file conversion operations:
●
To import a PDF document from another file format.
●
To export a PDF document to another file format.
To add a new file conversion handler, you provide a set of callback functions, specify them in the
AVConversionToPDFHandler
or
AVConversionFromPDFHandler
structures, and invoke the
AVAppRegisterToPDFHandler
or
AVAppRegisterFromPDFHandler
methods to register them.
Specify the file types that the plug-in can convert and whether it can perform synchronous conversion
(required for the handler to be accessible from the batch framework). Upon registration, the conversion
handlers are automatically added to the respective Open and Save As dialog boxes.