data-id=developing-for-interapplication-communication

Developing for Interapplication Communication

With IAC, an external application can control Acrobat or Acrobat Reader. For example, you can write an application that launches Acrobat, opens a specific file, and sets the page location and zoom factor. You can also manipulate PDF files by, for example, deleting pages or adding annotations and bookmarks. Communication between your application and the Acrobat or Acrobat Reader application occurs through objects and events.

data-id=50401306_70200
data-id=about-the-api-object-layers

About the API object layers

You can think of the Acrobat API as having two distinct layers that use IAC objects:

You can control the application’s user interface and the appearance of its window by either using its PD layer object, PDPage, or by using its AV layer object, AVDoc. The PDPage object has a method called Draw that exposes the rendering capabilities of Acrobat. If you need finer control, you can create your application with the AVDoc object, which has a function called OpenInWindow that can display text annotations and active links in your application’s window.

You can also treat a PDF document as an ActiveX document and implement convenient PDF browser controls through the AcroPDF object. This object provides you with the ability to load a file, move to various pages within a file, and specify various display and print options. A detailed description of its usage is provided in Summary of OLE objects and methods.

data-id=object-reference-syntax

Object reference syntax

The Acrobat core API exposes most of its architecture in C, although it is written to simulate an object-oriented system with nearly fifty objects. The IAC interface for OLE automation and Apple events exposes a smaller number of objects. These objects closely map to those in the Acrobat API and can be accessed through various programming languages.

DDE does not organize IAC capabilities around objects, but instead uses DDE messages to Acrobat.

OLE automation, Apple events, and AppleScript each refer to the objects with a different syntax.

data-id=objects-in-the-acrobat-application-layer

Objects in the Acrobat application layer

This table describes the IAC objects in the Acrobat application (AV) layer. The first three objects are the primary source for controlling the user interface.

Object
Description
OLE automation class name
Apple event class name
AVApp
Controls the appearance of Acrobat. This is the top-level object, representing Acrobat. You can control the appearance of Acrobat, determine whether an Acrobat window appears, and set the size of the application window. Your application has access to the menu bar and the toolbar through this object.
AcroExch.App
Application
AVDoc
Represents a window containing an open PDF file. Your application can use this object to cause Acrobat to render into a window so that it closely resembles the Acrobat window. You can also use this object to select text, find text, or print pages. This object has several bridge methods to access other objects. For more information on bridge methods, see Summary of OLE objects and methods.
AcroExch.AVDoc
Document
AVPageView
Controls the contents of the AVDoc window. Your application can scroll, magnify, or go to the next, previous, or any arbitrary page. This object also holds the history stack.
AcroExch.AVPageView
PDF Window
AVMenu
Represents a menu in Acrobat. You can count or remove menus. Each menu has a language-independent name used to access it.
None `
Menu``
AVMenuItem
Represents a single item in a menu. You can execute or remove menu items. Every menu item has a language-independent name used to access it.
None
Menu item
AVConversion
Represents the format in which to save the document.
None
conversion
data-id=objects-in-the-portable-document-layer

Objects in the portable document layer

This table describes the IAC objects in the portable document (PD) layer.

Object
Description
OLE automation class name
Apple event class name
PDDoc
For OLE automation, the first page of a document is page 0. For Apple events, the first page is page 1.
AcroExch.PDDoc
Document
PDPage
Represents one page of a PDDoc object. You can use this object to render Acrobat to your application’s window. You can also access page size and rotation, set up text regions, and create and access annotations. ` For OLE automation, the first page of a document is page 0. For Apple events, the first page is page 1.
AcroExch.PDPage
page``
PDAnnot
Manipulates link and text annotations. You can set and query the physical attributes of an annotation and you can perform a link annotation with this object. Apple events have two additional, related objects: PDTextAnnot, a text annotation, and PDLinkAnnot, a link annotation.
AcroExch.PDAnnot
annotation
PDBookmark
Represents bookmarks in the PDF document. You cannot directly create a bookmark, but if you know a bookmark’s title, you can change its title or delete it.
AcroExch.PDBookmark
bookmark
PDTextSelect
Causes text to appear selected. If selected text exists within an AVDoc object, your application can also access the words in that region through this object.
AcroExch.PDTextSelect
None
data-id=plugins-for-extending-the-iac-interfaces

Plugins for extending the IAC interfaces

You can extend the functionality of the IAC interfaces by writing Plugins that use core API objects that are not already part of the IAC support system. The following graphic shows the software architecture needed to establish a connection. The plug-in calls methods through host function tables (HFTs).

Using Plugins for interapplication communication

[iacplugin.png]

Similarly, the JSObject interface provides you with convenient access to the Acrobat features made available through JavaScript. Take advantage of this interface wherever possible. Its usage is explained in Using the JSObject interface.

Tip

Your plugins should make use of a broker to work correctly when protected mode is enabled.

data-id=developing-for-acrobat-reader

Developing for Acrobat Reader

On Windows, the only OLE automation supported for Reader is the PDF browser controls interface, which enables you to treat a PDF document as an ActiveX document within an external application. This makes it possible to load a file, move to various pages within the file, highlight a text selection, and specify various print and display options, as shown below.

PDF browser controls

[browsercontrols.png]

PDF browser controls are available through the AxAcroPDFLib.AxAcroPDF interface, which provides the following methods used to programmatically control the PDF document window:

data-id=dde-messages

DDE messages

Adobe Reader supports the following DDE messages:

data-id=apple-events

Apple events

On Mac OS, you may use Apple events and AppleScript. Adobe Reader supports only the following required Apple events: