
Adobe Acrobat SDK
Working with Host Function Tables
Developing Plug-ins and Applications
Importing an existing HFT 173
END_HANDLER
return gMyHFT;
}
/*
** Called by viewer to set up for exporting an HFT. This method
** creates a new HFT server and provides a callback that
** provides the HFT.
*/
ACCB1 ASBool ACCB2 PluginExportHFTs(void)
{
gMyHFTServer = NULL;
DURING
//Create an HFT callback function
HFTServerProvideHFTProc provideMyHFTCallback =
ASCallbackCreateProto(HFTServerProvideHFTProc, &ProvideMyHFT);
//Create an HFT server
gMyHFTServer = HFTServerNew("MyHFT", provideMyHFTCallback,NULL, NULL);
HANDLER
return false;
END_HANDLER
return true;
}
Importing an existing HFT
You must import an existing HFT in order to invoke methods that are exposed through the HFT. To import
an existing HFT, you must invoke the
ASExtensionMgrGetHFT
method within the
PluginImportReplaceAndRegister
handshaking method. The
ASExtensionMgrGetHFT
method
requires the following arguments:
●
An
ASAtom
object that specifies the HFT server that corresponds to the HFT to import.
●
An
ASVersion
object that specifies the version of the HFT.
The
ASExtensionMgrGetHFT
method returns an
HFT
object. The following code example shows the
PluginImportReplaceAndRegister
handshaking method that contains application logic that
imports the
MyHFT
HFT.
Example 16.5
Importing an existing HFT
ACCB1 ASBool ACCB2 PluginImportReplaceAndRegister(void)
{
gMyHFT = ASExtensionMgrGetHFT(ASAtomFromString("MyHFT"), 1);
return (gMyHFT != NULL);
}
Note:
Both the exporting and importing plug-ins must be located in Acrobat or Adobe Reader’s plug-ins
directory. If the exporting plug-in is not located in this directory, the importing plug-in cannot
successfully import an HFT.