Snippet Runner Cookbook
Introduction
The SnippetRunner architecture consists of these major components:
-
A back-end server that provides the basic functionality, which includes a parameter input mechanism, debug support, and exception handling. For the Acrobat SDK, the back-end server is the SnippetRunnerServer Acrobat plug-in. For the PDF Library, it is the SnippetRunner application.
-
The SnippetRunner Common Interface, which acts as a client to the back-end server and provides a unified cross-platform user interface to use and extend SnippetRunner functionality.
Installing and running SnippetRunner
SnippetRunner consists of a set of files, organized into folders in the Samples\SnippetRunner\ directory of the Acrobat SDK or PDF Library SDK. The directory includes the following files:
-
Source code files for the SnippetRunner server. These files are located in the Sources\platform\ directory. For each platform, there is a project file you can use to compile SnippetRunner along with the SDK header files. It consists of a .vcproj file for Microsoft® Windows®, a .xcodeproj file for Mac OS, and makefiles for UNIX® platforms.
-
SnippetRunner environment and utility files. These files are located in the Sources\platform\Acrobat (for the Acrobat SDK only) and Sources\platform\Shared directories.
-
Individual code snippets. Each of these is intended to demonstrate one or more APIs. Each snippet exists as a single, separate file within the Sources\snippets\Acrobat (for the Acrobat SDK only) or Sources\snippets\Shared directory, and is included in the SnippetRunner project. If you build your own snippets (see Writing Snippets), you can add them to the SnippetRunner project and rebuild the project.
-
External files required by snippets. These are in the ExampleFiles directory and can be sample files for input or resources for user interface components.
Before using the SnippetRunner, you need to build it in the appropriate manner for your platform. For the Acrobat SDK, after the SnippetRunner project is built, the SnippetRunner Server plug-in must be installed in the appropriate plug_ins directory so that it will be loaded by Acrobat when it is launched. It will be copied automatically after being built if the AcroSDKPIDir environment variable is defined, or it may be copied manually. For the PDF Library, the SnippetRunnerServer application will be executed when the Common Interface is launched (see Starting the Common Interface for the PDF Library).