
Adobe Acrobat SDK
Creating Plug-in and PDF Library Applications
Developing Plug-ins and Applications
Adding the PIMain source file 53
Adding the PIMain source file
You must add the PIMain.c file to your project in order to create a plug-in. This source file contains
application logic such as handshaking methods, that are required by plug-ins. You can find this file in the
following directory:
\Acrobat SDK\PluginSupport\Headers\API
After you add this file, you can add application logic to your project.
Note:
As a plug-in developer, you will never have to create the application logic that is located in the
PIMain.c file or modify this file. However, you must include this file in your project.
Adding application logic
You must add a source file to your project that contains the following methods:
●
PluginExportHFTs
●
PluginImportReplaceAndRegister
●
PluginInit
●
PluginUnload
●
GetExtensionName
●
PIHandshake
You can copy the source code that is located in the StartInit.cpp file (located in the Starter plug-in) and
paste it. For information about these methods, see
“About plug-in initialization” on page 27
.
The entry point to a plug-in is the
PluginInit
method. For example, if you add the following line of code
to this method, an alert box is displayed when Adobe Reader or Acrobat is started.
AVAlertNote("This is your first plug-in");
You can add an application to the
PluginInit
method to meet your business requirements. You can
invoke other user-defined functions that you create or you can add application logic to this method that
performs a specific task. For example, you can add application logic to this method that adds a new menu
item to Adobe Reader or Acrobat. For information, see
“Creating Menus and Menu Commands” on
page 88
.
Compiling and building your plug-in
You must compile your plug-in to build the API file. As stated earlier in this guide, plug-ins are equivalent
to Windows DLLs; however, the file extension is .api, not .dll. Once you create an API file, you must add it to
the following directory:
\Program Files\Adobe\Acrobat\plug_ins
After you add the plug-in to this directory, you must restart Adobe Reader or Acrobat in order for the
plug-in to take affect.