Multithreading; Upgrading Existing Plug-Ins; Detecting Supported Apis - Adobe ACROBAT SDK 8.1 Manual

Developing plug-ins and applications
Table of Contents

Advertisement

Adobe Acrobat SDK
Developing Plug-ins and Applications

Multithreading

When using the thread-safe PDF Library, initialization and termination now additionally need to be
performed for each thread that calls into the library, as well as at the process level. The interfaces for
per-thread initialization/termination are the same as before.
Since each thread acquires an independent PDF Library memory context, you should not share PDF
Library data and resources among threads. This includes sharing the same PDF file.
The Adobe PDF 8.0 libraries are thread-safe. To use threads, simply make the appropriate system call
(
beginthreadex
Library data types. However, they share the same process heap; therefore, an application can share generic
data types between threads. Multiple threads can open the same file read-only; however, multiple threads
should not attempt to write to the same PDF document.
In Windows,
functions, including file I/O and string manipulation. It is best to
which performs extra bookkeeping to ensure thread safety.

Upgrading existing plug-ins

This section discusses how to upgrade an existing plug-in to an Acrobat or Adobe Reader 8.0 plug-in. For
Windows, plug-ins written for a version of Acrobat previous to Acrobat 8 are, in most cases, binary
compatible with Acrobat 8. That is, pre-Acrobat 8 plug-ins will usually work as is with Acrobat 8. You can
test existing plug-ins for compatibility with Acrobat 8. If they do not work, they may need to be rebuilt
with the new headers in the Acrobat 8 SDK. Additionally, in order for your plug-in to use new functionality
that is available with the Acrobat 8 SDK, such as the ability to work with Unicode-named files, you must
update the directory that stores header and library files with Acrobat 8 header and library files. For
information, see
For Mac OS, plug-ins developed for earlier versions of Acrobat will not load in Acrobat 8. In Acrobat 7,
plug-ins could be built as frameworks or bundles. However, for Acrobat 8, all plug-ins must be built as
Carbon bundles against the Acrobat 8 SDK headers in order to be compatible with Mac OS X system
frameworks and libraries (rather than MSL), GCC 4.0, and Mach-O as supported by the Xcode development
environment. Therefore, for existing Mac OS plug-ins, a variety of code incompatibilities may exist.

Detecting supported APIs

Acrobat Professional supports the full set of APIs. For Acrobat Standard and Adobe Reader, if you try to use
an API that is not supported, nothing will happen. The same HFT version numbers are used across
products, so all APIs are callable on all products, but certain APIs simply will not work on certain products.
Additionally, the Extended APIs provided by plug-ins will not work if an Acrobat product does not support the
use of those APIs. The HFTs will not load, so you need to check whether the HFT was successfully imported.
It is possible to determine in your code whether the HFT you are expecting is in fact the one that you are
importing, and whether it imported at all: simply check for a
be returned in the following call if
gAcroColorHFT = ASExtensionMgrGetHFT(ASAtomFromString(AcroColorHFTNAME),
PI_ACROCOLOR_VERSION);
Plug-ins that use new HFTs introduced with Acrobat 8.0 will not run on Acrobat versions prior to 8.0.
Whether or not an attempt to load these HFTs forces the plug-in to fail is controlled by flags in PIMain.c of
on Windows, and
is not recommended if the application is using most stdio.h-defined
CreateThread
"Including Acrobat SDK library files" on page
AcroColorHFTNAME
on UNIX). Multiple threads cannot share PDF
pthread_create
with the specified version is not available:
Creating Plug-in and PDF Library Applications
use _beginthreadex
48.
return value. For example, a
NULL
Multithreading
59
on Windows,
will
NULL

Advertisement

Table of Contents
loading

Table of Contents