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:
- The Acrobat application (AV) layer. The AV layer en3bles you to control how the document is viewed. For example, the view of a document object resides in the layer associated with Acrobat.
- The portable document (PD) layer. The PD layer provides access to the information within a document, such as a page. From the PD layer you can perform basic manipulations of PDF documents, such as deleting, moving, or replacing pages, as well as changing annotation attributes. You can also print PDF pages, select text, access manipulated text, and create or delete thumbnails.
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.
- In OLE, you use the object name in either a Visual Basic or Visual C#
CreateObjectstatement or in an MFCCreateDispatchstatement. - In Apple events, you use the name of the object in a
CreateObjSpecifierstatement. - In AppleScript, you use the object name in a
set... tostatement.
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.
AcroExch.AppApplicationAcroExch.AVDocDocumentAVDoc window. Your application can scroll, magnify, or go to the next, previous, or any arbitrary page. This object also holds the history stack.AcroExch.AVPageViewPDF WindowMenu itemconversiondata-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.
AcroExch.PDDocDocumentPDDoc 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.PDPagePDTextAnnot, a text annotation, and PDLinkAnnot, a link annotation.AcroExch.PDAnnotannotationAcroExch.PDBookmarkbookmarkAVDoc object, your application can also access the words in that region through this object.AcroExch.PDTextSelectdata-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:
GoBackwardStackGoForwardStackGotoFirstPageGotoLastPageGotoNextPageGotoPreviousPageLoadFilePrintPrintAllPrintAllFitPrintPagesPrintPagesFitPrintWithDialogSetCurrentHighlightSetCurrentPageSetLayoutModeSetNamedDestSetPageModeSetShowScrollbarsSetShowToolbarSetViewSetViewRectSetViewScrollSetZoomSetZoomScroll
data-id=dde-messages
DDE messages
Adobe Reader supports the following DDE messages:
AppExitCloseAllDocsDocCloseDocGoToDocGoToNameDestDocOpenFileOpenFileOpenExFilePrintFilePrintExFilePrintSilentFilePrintSilentExFilePrintToFilePrintToEx
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:
openprintquitrun