How to Use the JavaScript Debugger with Adobe Reader

| No Comments

This question has come up a few times recently and in the fine tradition of “Amateurs copy – artist steal”
I’m lifting the section of the Acrobat 9 SDK documentation that describes how to enable the JavaScript debugger for Reader 9.

Using the Debugger with Adobe Reader

The JavaScript Debugger is a fully capable debugger that allows you to set breakpoints and inspect variable values while stepping through code. While it is normally accessed from the Acrobat Pro user interface, it can also be triggered to appear in Adobe Reader when an exception occurs.

Though fully supported JavaScript debugging is only available in Acrobat Pro, the following instructions to make the complete Debugger functionality available in Adobe Reader on Windows and Mac OS platforms are provided as a courtesy. For Windows, 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 the Acrobat Developer Center or in the SDK installation (Acrobat 9.0 SDK/JavaScriptSupport/Debugger/debugger.js), must be copied to the Acrobat 9.0/Reader/JavaScripts folder.
2. Create key/value pairs in the registry settings, starting at the location HKEY_CURRENT_USER\Software\Adobe\Acrobat Reader\9.0\JSPrefs\ on Windows as shown in the table below, or in the property list file :Library:Preferences:com.adobe.Reader9.0.plist on Mac OS. For Mac OS, use an appropriate editor for the property list file, and add the following children under JSPrefs, using Type : Array in each case: ConsoleOpen, ConsoleInput, EnableDebugger, 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.

Registry key/value pairs for Windows

bConsoleInput REG_DWORD 0x00000001
bEnableDebugger REG_DWORD 0x00000001
iExceptions REG_DWORD 0x00000002
(This will break into the Debugger when exceptions occur.)

Note: 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).

As you learned earlier when opening the JavaScript Console, which is integrated with the Debugger dialog box, the Debugger may be opening in Acrobat Pro by selecting Advanced > Document Processing > JavaScript Debugger. In addition, the Debugger automatically opens if a running script throws an exception or encounters a previously set break point.

Note: The JavaScript Debugger cannot be used to analyze JavaScript stored in HTML pages viewed by web browsers or any other kind of scripting languages.

Link to the original document 

Sorry, the comment form is closed at this time.

Sorry, the comment form is closed at this time.