Acrobat JavaScript Tools
Using the Acrobat JavaScript Debugger
2
Using the Acrobat JavaScript Debugger
The Acrobat JavaScript Debugger is a fully capable JavaScript debugger that allows you to
set breakpoints and inspect variable values while stepping through code. While it is
normally accessed from the Acrobat Professional user interface, it can also be triggered to
appear in Adobe Reader when an exception occurs.
Though fully supported Acrobat JavaScript debugging is only available in Acrobat
Professional, the following instructions to make the complete debugger functionality
available in Adobe Reader on Windows and Macintosh platforms are provided as a
courtesy. Note that this procedure involves editing the registry. Adobe Systems
Incorporated does not provide support for editing the registry, which contains critical
system and application information. It is recommended that you back up the registry
before modifying it.
1.
The file
debugger.js
, available at
http://partners.adobe.com/asn/acrobat/docs.jsp
or in
the SDK installation (
Acrobat 7.0 SDK/JavaScriptSupport/Debugger/debugger.js
),
must be copied to the
Acrobat 7.0/Reader/JavaScripts
folder.
2.
Create key/value pairs in the registry settings, starting at the location
HKEY_CURRENT_USER\Software\Adobe\Acrobat Reader\7.0\JSPrefs\
on Windows
as shown below in
Table 2.2,
or in the property list file
<user>:Library:Preferences:com.adobe.Reader7.0.plist
on the Macintosh. For the
Macintosh, use an appropriate editor for the property list file, and add the following
children under
JSPrefs,
using
Type : Array
in each case:
Console Open, Console Input,
Enable Debugger,
and
Exceptions.
Under each of these children, add the following
children:
0 (number)
and
1 (boolean).
3.
Close and restart Adobe Reader. At this point the debugger will be available.
T
ABLE
2.2
Registry Key/Value Pairs for Windows
bConsoleInput
bEnableDebugger
iExceptions
REG_DWORD 0x00000001
REG_DWORD 0x00000001
REG_DWORD 0x00000002
(this will break into the debugger
when exceptions occur)
N
OTE
:
Since Adobe Reader does not provide access to the debugger through its menu
items or the
Ctrl+j
key sequence, the only ways to access the debugger are to
execute a JavaScript, cause an error, or customize the user interface (for example,
you could add a button that runs a JavaScript causing the debugger to appear).
Acrobat JavaScript Scripting Guide
45