
Adobe Acrobat SDK
Creating Plug-in and PDF Library Applications
Developing Plug-ins and Applications
Initialization and termination 58
Before you run your application, set the
PSRESOURCEPATH
and
ACRO_RES_PATH
environment variables
to point to your fonts. For example, to set these environment variables manually before you run your
application:
setenv PSRESOURCEPATH /user/yourname/PSFont
setenv ACRO_RES_PATH /user/yourname/PSFont
Alternatively, you can define the environment variables within the application using the
putenv
system call.
Initialization and termination
Applications must initialize and terminate the Adobe PDF Library appropriately:
●
Call
PDFLInit
to set up internal data structures, locate required resources such as fonts, and perform
initialization (such as setting client-provided memory allocation routines). Calling most library
functions without successfully initializing the library results in error conditions. The rest of this section
provides details on using PDFLInit.
●
Call
PDFLTerm
to clean up before an application terminates or when access to PDF Library
functionality is no longer needed.
Since the PDF Library supports thread-safety (since version 6.1.2), initialization and termination are
handled on a per-thread basis.
The
PDFLInit
function takes as a parameter a
PDFLData
structure, defined in the API header file
PDFInit.h. You must provide valid values for the following members of the structure before passing it to
PDFLInit
:
●
size denotes the size of the structure and can be obtained with
sizeof(PDFLDataRec)
.
●
listLen is the number of directories listed in dirList.
●
dirList is an array of directories that contain font resources. The following discussion explains how to
use this member on each of the supported platforms.
In Windows and Mac OS, the PDF Library searches for fonts in the default system and in their
subdirectories (to 99 levels). You can specify additional font directories to search (also to 99 levels) in the
dirList array. (Note that this can affect performance.)
Here is an example showing how to pass the font paths to dirList for Windows:
pdflLibData.dirList[0]= strdup("C:\\Myfontfolder\\CMap");
pdflLibData.dirList[1]= strdup("C:\\Myfontfolder\\CIDFont");
pdflLibData.dirList[2]= strdup("C:\\Myfontfolder\\Font");
The paths can be either full paths or paths relative to the directory from which the executable linking in
the Adobe PDF Library was launched. You can set the value
kPDFLInitIgnoreDefaultDirectories
in the flags field of the
PDFLData
structure to indicate that the default font directories should not be
searched but only the directories provided in dirList.
For more details, see the functions
PDFLGetDirList_Win
and
PDFLGetDirList_Mac
in the
MyPDFLibUtils.cpp file in the
Samples/utils
directory.
In UNIX, the PDF Library searches by default for fonts in the directory from which the application was
launched. Use dirList member to specify additional locations of font resources.
For more details, see the function
PDFLGetDirList_Unx
in the MyPDFLibUtils.cpp file in the
Samples/utils
directory.