Deciding Which Acrobat SDK Technology to Use
You can develop software that integrates with Acrobat and Acrobat Reader in three ways: JavaScript, plug-ins, and IAC.
Based on your application’s requirements, choose the appropriate technologies for development. In some situations, the desired functionality is only available using one technology. In other situations, you can choose between two or more technologies. For example, you can add menu items to Acrobat using either JavaScript or a plug-in.
You can also use more than one technology in a single application or single document. For example, you can use both plug-ins and JavaScript to implement a particular feature.
Deciding between plug-ins and JavaScript
This section presents topics to consider as you decide whether to use plug-ins or JavaScript to implement a particular functionality.
Comparison of plug-ins and JavaScript
Plug-ins |
JavaScript |
|
Scope |
A plug-in affects all PDF documents viewed by Acrobat. |
JavaScript can affect either a single document or all PDF documents. |
Installation and distribution |
Plug-ins must be placed in the Plug_ins folder or directory by an installer or by the user. |
Document-level JavaScript code is easier to distribute since it can be included directly within the PDF file and does not require an installer. Folder-level JavaScript code must be placed in the Acrobat application JavaScript folder or the user’s JavaScript folder. |
Low-level access |
Plug-ins can access and manipulate low-level objects in the PDF object model, such as the Cos layer. |
JavaScript can access a limited set of AV and PD layer objects. |
Execution speed |
Plug-ins are compiled and loaded when Acrobat initializes. |
Execution of JavaScript code is slower than plug-in code because it is interpreted instead of compiled. However, the difference is noticeable only in computation-intensive applications, such as a full-text search in a large PDF file. |
Ease of implementation |
Plug-ins are developed in C or C++ and are compiled and linked in the appropriate development environment. You must include all necessary header files for your application. |
JavaScript scripts are easier to write and implement since they are developed using the editor and debugger that come as part of Acrobat Professional DC. Developers can also use an external editor to create and edit JavaScript code. |
Cross-platform compatibility |
Plug-ins must be built on different platforms to handle certain platform-specific issues. |
JavaScript is cross-platform compatible. |
Situations where plug-ins are better than JavaScript
In general, plug-ins allow for more direct control over Acrobat than JavaScript. There is a richer set of APIs that you can use from a plug-in. For example, the following tasks can only be done using a plug-in; there is no equivalent JavaScript functionality:
• Accessing COS and other low-layer objects
• Manipulating PDF content streams
• Creating new annotation or action types
• Modifying the ASFixed scale factor for large PDF file sizes
• Accessing platform-specific services or events
• Getting and setting wireframe drawing mode
Situations where JavaScript is better than plug-ins
The following example tasks can be done easily using JavaScript, but have no equivalent plug-in API:
• Using SOAP and other web services
• Manipulating multimedia in PDF documents
• Setting up an automated email review workflow
• Describing the state model for the review
• Searching Acrobat Help
•Using Acrobat security policies
Some of these example tasks, such as SOAP and web services, can in fact be done with a plug-in by using low-level APIs. However, this is a time-consuming approach and requires an in-depth knowledge of the low-level APIs.
When to use IAC
To take advantage of Acrobat functionality from within an external application, use interapplication communication (IAC).
Viewing PDF documents from an external application
If your Windows application only views a PDF document and does not need to edit it in any way, use the PDF Browser Controls to view the document from your external VB or C# application. When you open a document for viewing using the PDF Browser Controls, the document is displayed in the application window. Acrobat toolbars are also displayed and can be used with no additional API calls. The toolbars can be hidden. Acrobat or Acrobat Reader must be installed for the PDF Browser Controls to work.
You can also use the IAC API to open and view a PDF document. However, when you use the IAC API, no toolbars are displayed. You must place your own buttons with corresponding API calls for standard toolbar tasks such as printing and searching.
Controlling Acrobat from an external application
If you need to do more than just view a PDF document from your application, you can use the IAC API to perform these tasks:
• Get annotations, text and form data from a PDF document
• Search a PDF document
• Manipulate a PDF document, editing and adding content
• Control Acrobat (but not Acrobat Reader) remotely
You can also extend the functionality of the IAC interfaces by writing plug-ins that use core API objects not already part of the IAC support system. For more information on IAC, see Developing Applications Using Interapplication Communication and the Interapplication Communication API Reference.
Samples provided with the Acrobat SDK
The Acrobat DC SDK has a large number of sample applications, plug-ins, and scripts to demonstrate how to use the SDK technologies. Reviewing the samples will help you understand when to choose JavaScript, plug-ins, or IAC functionality for a particular implementation.
For more information on the samples, see the Guide to SDK Samples and the Snippet Runner Cookbook. Samples are regularly added to the Acrobat DC SDK. For the latest samples, see http://www.adobe.com/go/acrobat_developer.