Adobe 12001196 - Acrobat - Mac Manual
Adobe 12001196 - Acrobat - Mac Manual

Adobe 12001196 - Acrobat - Mac Manual

Javascript
Hide thumbs Also See for 12001196 - Acrobat - Mac:
Table of Contents

Advertisement

Acrobat JavaScript
Scripting Guide
c
b b
Technical Note #5430
Version: Acrobat 6.0
ADOBE SYSTEMS INCORPORATED
Corporate Headquarters
345 Park Avenue
San Jose, CA 95110-2704
(408) 536-6000
http://partners.adobe.com
May 2003

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the 12001196 - Acrobat - Mac and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Summary of Contents for Adobe 12001196 - Acrobat - Mac

  • Page 1 Acrobat JavaScript Scripting Guide Technical Note #5430 Version: Acrobat 6.0 ADOBE SYSTEMS INCORPORATED Corporate Headquarters 345 Park Avenue San Jose, CA 95110-2704 (408) 536-6000 http://partners.adobe.com May 2003...
  • Page 2 Adobe Systems Incorporated. PostScript is a registered trademark of Adobe Systems Incorporated. All instances of the name PostScript in the text are references to the PostScript language as defined by Adobe Systems Incorporated unless otherwise stated. The name PostScript also is used as a product trademark for Adobe Systems’...
  • Page 3: Table Of Contents

    Contents Contents Chapter Preface ......7 Introduction......... . . 7 Audience .
  • Page 4 Contents Using the Built-in Acrobat JavaScript Editor ......24 Using an External Editor ........24 Additional Editor Capabilities .
  • Page 5 Contents Exercise: Calculator ........47 Calculator .
  • Page 6 Contents Restricting Permissions ....... . . 81 Digital Signatures ........81 How can I make restricted Acrobat JavaScript methods available to users? .
  • Page 7: Preface

    Preface Introduction Welcome to the Adobe Acrobat JavaScript Scripting Guide . This scripting guide is designed to give you an overview of how you can use the Acobe Acrobat 6 Pro JavaScript development environment to develop and enhance Acrobat applications.
  • Page 8: Assumptions

    Preface How To Use This Guide After reading this guide and completing the exercises, you should be equipped to start using Acrobat JavaScript. During the development process, you’ll likely find yourself reviewing the content of this guide, as well as exploring additional, more in-depth information that updates to this guide offer in key technical areas.
  • Page 9: Font Conventions Used In This Book

    Placeholders in code AFSimple_Calculate( cFunction , examples cFields ) blue Live links to Web pages The Acrobat Solutions Network URL is: http://partners/adobe.com/asn/ Live links to sections Using the SDK. within this document Live links to other See the Acrobat Core API Overview...
  • Page 10: For More Information

    SDK. If, for some reason, you did not install the entire SDK and you do not have all the documents, please visit Adobe Solutions Network Web site to find the documents you need. Then install them in the appropriate directories. You can use the Acrobat SDK Documentation Roadmap located at the beginning of this document as a guide.
  • Page 11: Chapter 1 Introduction To Acrobat Javascript

    However, Acrobat provides far more capabilities than a simple document viewer. You can enhance an Adobe Portable Document Format (PDF) document so that it contains fields to capture user-entered data as well as buttons to initiate user actions. This type of...
  • Page 12: What Is Acrobat Javascript

    PDF files. Acrobat also contains functionality to support online team review. Documents that are ready for review are converted to Adobe PDF. When a reviewer views an Adobe PDF document in Acrobat and adds comments to it, those comments (or annotations) constitute an additional layer of information on top of the base document.
  • Page 13: What Can You Do With Acrobat Javascript

    Acrobat JavaScript enables you to do a wide variety of things within a PDF document. The Adobe Solutions Network (ASN) has an Adobe Acrobat JavaScript Training course that covers a wide variety of the possibilities available within Acrobat JavaScript. This course material is in a PDF file available at: http://partners.adobe.com/asn/developer/training/acrobat/javascript/main.html...
  • Page 14 “Integrating with a Database, ” for details. Setting the comment repository preference If you plan on using Adobe Acrobat’s collaborative review capabilities, you need to specify the type of comment repository to use, as well as its location. These are referred to as comment repository preferences.
  • Page 15: Acrobat Javascript Object Overview

    By interacting with the App object, you can get to all of the currently open PDF documents and customize Acrobat by adding menus and menu items. You can also query App to determine which type of Adobe product (for example, Reader, Approval, or full Acrobat) and which version the end user is using.
  • Page 16: Other Common Acrobat Javascript Objects

    The Console object is a static object to access the JavaScript console for displaying debug messages and executing JavaScript. It does not function in the Adobe Reader or Acrobat Standard. Use the Console object as a debugging aid and as a means of interactively testing code.
  • Page 17: Database Objects

    Introduction to Acrobat JavaScript Acrobat JavaScript Object Overview see the ASN JavaScript training module on “Location Matters” and the ASN JavaScript training module on “Batch Processing with Sequences. ” Util The Util object is a static JavaScript object that defines a number of utility methods and convenience functions for string and date formatting and parsing.
  • Page 18 Introduction to Acrobat JavaScript Acrobat JavaScript Object Overview Acrobat JavaScript Scripting Guide...
  • Page 19: Chapter 2 Acrobat Javascript Editor And Debugger Console

    Acrobat JavaScript Editor and Debugger Console Introduction to the JavaScript Editor and Debugger Console Acrobat provides a development environment in which you can implement and test Acrobat JavaScript functionality. On both Windows and Macintosh systems, you have a choice of using Acrobat’s built-in editor or a third-party editor to develop your code. To introduce you to a simple method of evaluating short scripts, this chapter details how you can use Acrobat’s JavaScript debugger console with the built-in JavaScript editor to evaluate scripts.
  • Page 20: Javascript Console

    Acrobat JavaScript Editor and Debugger Console JavaScript Console JavaScript Console The Acrobat JavaScript console provides an interface for testing and debugging your JavaScript code. It is editable and interactive. The console is also handy for experimenting with object properties and methods before you use them in your code. You can use the console as an editor and interactively execute lines or blocks of code within the console.
  • Page 21: Using A Javascript Editor

    Acrobat JavaScript Editor and Debugger Console Using a JavaScript Editor To move the cursor four spaces to the left, press Shift+Tab. (This moves the cursor to the beginning of the line if it is fewer than four spaces from the left.) To move a whole line or block of code to the right four spaces, highlight the code, or a portion of a line, then press Tab.
  • Page 22 Acrobat JavaScript Editor and Debugger Console Using a JavaScript Editor 5. Click Add to open the JavaScript editor. 6. In the editor window, write the JavaScript script that you want to run when the user opens the page. 7. When you are done, click Close to close the editor. If there are errors in your code, the JavaScript editor will highlight the code line in question and display an error message, as shown in Figure...
  • Page 23: Specifying The Default Javascript Editor

    Acrobat JavaScript Editor and Debugger Console Specifying the Default JavaScript Editor Specifying the Default JavaScript Editor You can choose to either use the built-in JavaScript editor that comes with Acrobat, or an external JavaScript editor of your choice. To set the default JavaScript editor that you want to use: 1.
  • Page 24: Using The Built-In Acrobat Javascript Editor

    Acrobat JavaScript Editor and Debugger Console Using the Built-in Acrobat JavaScript Editor 4. Click OK to close the Preferences dialog box. Using the Built-in Acrobat JavaScript Editor You can use the built-in Acrobat JavaScript editor to evaluate JavaScript code, just as you use the Acrobat JavaScript console.
  • Page 25: Specifying Additional Capabilities To Your Editor

    Acrobat JavaScript Editor and Debugger Console Using an External Editor Edit > Preferences > JavaScript dialog. This ensures that your editing work is not discarded. If your editor accepts a starting line number on the command line, Acrobat also supports the option of starting the editor on a line that contains a syntax error by making the line number available as a parameter (%n) to insert in the command line.
  • Page 26: Testing Whether Your Editor Supports Opening At Syntax Error Locations

    Acrobat JavaScript Editor and Debugger Console Using an External Editor When Acrobat needs to open the JavaScript editor, it makes the appropriate substitutions in the command line and executes it with the operating sytem shell. In the above case, if the syntax error were on line 43, the command line generated would be something like: "C:\Program Files\vslick\win\vs.exe"...
  • Page 27: Exercise: Working With The Javascript Console

    Acrobat JavaScript Editor and Debugger Console Exercise: Working with the JavaScript Console Saving and Closing a File with a Syntax Error If you save and close a file you have been editing and it contains a syntax error (on line 123, for example), Acrobat displays a dialog box with the following message prompting whether you want to fix the error: There is a JavaScript error at line 123.
  • Page 28: Enabling The Interactive Javascript Console

    Acrobat JavaScript Editor and Debugger Console Exercise: Working with the JavaScript Console Enabling the Interactive JavaScript Console The console window is part of the JavaScript debugger. To enable the console, you must enable the debugger. 1. In the Preferences dialog, select Enable JavaScript Debugger after Acrobat is restarted from the JavaScript Debugger options.
  • Page 29 Acrobat JavaScript Editor and Debugger Console Exercise: Working with the JavaScript Console 3. Click the Clear button (trash can icon) just below the console window to delete any contents that appear in the window. 4. Type the following code into the console: var myNumber = 1776;...
  • Page 30 Acrobat JavaScript Editor and Debugger Console Exercise: Working with the JavaScript Console Evaluating myNumber IGURE 7. Now evaluate the following line of code by typing it in below the existing console contents and pressing Enter with the cursor positioned on the code to be evaluated: console.println("\n\nThe value of myNumber is "...
  • Page 31 Acrobat JavaScript Editor and Debugger Console Exercise: Working with the JavaScript Console Evaluating a code line IGURE The console.println() method can be very useful to include in your JavaScript code to print debugging information and other messages to the console. It prints the text that you specify and then returns undefined.
  • Page 32 Acrobat JavaScript Editor and Debugger Console Exercise: Working with the JavaScript Console Acrobat JavaScript Scripting Guide...
  • Page 33: Acrobat Javascript Debugger

    Acrobat JavaScript Debugger Introduction to the Acrobat JavaScript Debugger The Acrobat JavaScript Debugger allows debugging of JavaScript code in Acrobat. It is a fully capable JavaScript debugger which lets you set breakpoints and inspect variable values while stepping through code. The debugger is not available in the Acrobat Reader. Debugging is controlled with a single dialog that you can open from the Acrobat menu item Advanced >...
  • Page 34: Enabling The Acrobat Javascript Debugger

    Acrobat JavaScript Debugger Enabling the Acrobat JavaScript Debugger Topics and Exercises Inspect Details Window Starting the Debugger Exercise: Calculator Known Issues Enabling the Acrobat JavaScript Debugger Before you can use the debugger, both JavaScript and the debugger must be enabled. Use the Edit >...
  • Page 35 Acrobat JavaScript Debugger Enabling the Acrobat JavaScript Debugger Figure 3.1 shows typical JavaScript debugger option settings. Each of the options is described in Table 3.1. JavaScript debugger options ABLE Option Meaning Enable Javascript To enable the debugger you must check this option. The debugger after debugger features such as setting breakpoints become available Acrobat is restarted...
  • Page 36: Debugger Dialog Window

    Acrobat JavaScript Debugger Debugger Dialog Window Debugger Dialog Window You can open the debugger dialog window without having a script to debug by using the Acrobat menu item Advanced > JavaScript > Debugger. Familiarize yourself with the parts of the window and the controls as described here before you attempt interactive debugging of a script.
  • Page 37: Debugger Buttons

    Acrobat JavaScript Debugger Debugger Buttons Debugger dialog IGURE Debugger Buttons The Acrobat JavaScript Debugger allows you to easily control what portions of the script you want to see executed. You can start the debugger using any of the ways described in “Starting the Debugger”...
  • Page 38: Resume Execution

    Acrobat JavaScript Debugger Debugger Buttons Debugger buttons IGURE Resume Interrupt Quit Step Into Step Out Step Over Debugger buttons summary ABLE Button Description Resume Execution Runs a script stopped in the debugger. Interrupt Halts execution. Quit Terminates script execution and closes the debugger dialog. Step Over Single steps through instructions but does not enter function calls encountered.
  • Page 39: Quit

    Acrobat JavaScript Debugger Debugger Buttons Quit The Quit button terminates the debugging session and closes the debugger dialog window. Step Over The Step Over button single-steps through instructions. Clicking Step Over at a function call executes the entire function in a single step rather than executing the function’s instructions one at a time with each click of the button.
  • Page 40: Debugger Scripts Window

    Acrobat JavaScript Debugger Debugger Scripts Window Debugger Scripts Window Scripts are automatically collected from a PDF file open in Acrobat when you open the debugger dialog. The debugger displays these in the Scripts window. Figure 3.5 shows an example. Scripts window IGURE Accessing Scripts in the Scripts Window To access scripts you want to display, you click the triangle next to an entry in the Scripts...
  • Page 41: Scripts Outside Pdf Files

    Acrobat JavaScript Debugger Call Stack List Scripts inside PDF files ABLE Location Access Document actions Advanced > JavaScript > Set Document Actions Page actions Click the page on the Pages tab; select Options > Page Properties Forms Double-click the form object in form editing mode (see below) to bring up the Form Properties dialog Bookmarks Click the bookmark on the Bookmarks tab;...
  • Page 42: Inspect Details Window

    Acrobat JavaScript Debugger Inspect Details Window entry represents a function call, or frame, in the stack. The text of an entry displays the line number of the function in the script and the function’s name. The most recent stack frame is the top of the stack and is displayed at the top of the Call Stack drop-down list.
  • Page 43: Inspecting Variables

    Acrobat JavaScript Debugger Inspect Details Window Inspect details window button controls IGURE Edit New Delete Inspecting Variables The capability of inspecting variables is a powerful tool that you can use to examine the current state of JavaScript objects and variables. It enables you to see the values for variables in the current stack frame, or local scope, being debugged.
  • Page 44: Watches

    Acrobat JavaScript Debugger Inspect Details Window Watches The Watches list enables you to customize your inspection of variables. Watches are JavaScript expressions evaluated every time the debugger stops at a breakpoint or a step in execution. You can add as many watches as you need in the Watches list. You can edit, add, or delete watches using the three buttons just below the Inspect details window.
  • Page 45 Acrobat JavaScript Debugger Inspect Details Window display an alert telling you that you cannot set a breakpoint on that location. You can only set a breakpoint next to the codeline containing the left curly brace. Figure 3.9, you can set the breakpoint on the line with the left curly brace following the function name callMe().
  • Page 46: Starting The Debugger

    Acrobat JavaScript Debugger Starting the Debugger Starting the Debugger You can start the debugger in four ways. Two of these ways allow you to debug from the start of execution. The other two allow you to start debugging from an arbitrary point in the script.
  • Page 47: Stepping Through Your Code

    Acrobat JavaScript Debugger Stepping Through Your Code Stepping Through Your Code The Acrobat JavaScript Debugger allows you to easily control what portions of the script you want to see executed. Four of the toolbar buttons allow you to step through your code when a script is stopped in the debugger.
  • Page 48: Calculator

    Acrobat JavaScript Debugger Exercise: Calculator – Step Into – Step Out – Quit Calculator Calc.pdf uses document-level and form field-level scripts to create the behavior of a simple calculator. The key pad consists of numeric and function keys, the period (.), the equals sign (=), as well as Cancel and Cancel Entry keys.
  • Page 49: Getting Started

    Acrobat JavaScript Debugger Exercise: Calculator causes a subsequent value entered (to the right of the point) to be divided by 10 to represent the tenths position. Testing the Calculator To familiarize yourself with the basic calculator operation, open Calc.pdf in Acrobat. Experiment with entering expressions and evaluating their results.
  • Page 50: Debugging A Runtime Error

    Acrobat JavaScript Debugger Exercise: Calculator 5. Summarize your findings. From the above, note that: – Button values display correctly. Clicking 9 displays 9, clicking 3 displays 3, and so forth in the Display field. – Function strings display correctly in the Func field. Clicking *, -, +, and so forth displays the correct function string.
  • Page 51: Another Runtime Error

    Acrobat JavaScript Debugger Exercise: Calculator 3.10 The value of accum is not updated IGURE Another runtime error 1. Enter 9 + 3 = The result of evaluation is 3. This is indicates another runtime error. 2. If you didn’t delete your watches from the previous session, you can reuse them. For each watch, select the watch in the Inspect details window.
  • Page 52: Known Issues

    Acrobat JavaScript Debugger Known Issues 3.11 Second Runtime Error IGURE Known Issues Due to some limitations in the JavaScript Debugger, debugging of certain classes of scripts in Acrobat is disabled or unavailable. Fortunately, there are plenty of other places and situations where scripts can be debugged, so that your script can be tested and then transported to its definitive place in case debugging is unavailable.
  • Page 53: Summary

    Acrobat JavaScript Debugger Summary The events DocWillPrint and DocDidPrint cannot be debugged because the printing progress bar conflicts with the debugger. Press the Escape key to clear this situation. Debug scripts using different event triggers and then change the trigger to the required event. Debugging scripts in Acrobat from inside a browser (IE, NS) has some limitations.
  • Page 54 Acrobat JavaScript Debugger Summary Acrobat JavaScript Scripting Guide...
  • Page 55: Using Acrobat Javascript In Forms

    Using Acrobat JavaScript in Forms Creating simple JavaScripts There are a number of simple JavaScripts you can integrate into your forms to enhance their interactive capabilities. The scripts described here are commonly used with Acrobat forms. Trying out these scripts in the forms you create will give you a glimpse of what JavaScript offers.
  • Page 56: Performing Arithmetic Calculations

    Using Acrobat JavaScript in Forms Creating simple JavaScripts 4. Delete the automatically generated text, defining a Today function, that is displayed in the script window. Type in the following text in the exact format (line wraps are OK) and click OK. var f = this.getField("Today");...
  • Page 57: Assigning A 'Go To Page' Action

    Using Acrobat JavaScript in Forms Creating simple JavaScripts 12.•Click Close in the Text Field Properties dialog. In Acrobat 5 you would have had to explicitly get each field from the this object and use the value properties of each field object, as in the following example (equivalent to the symplified syntax in step 10, above): "...
  • Page 58: Sending A Document Or Form Via E-Mail

    Using Acrobat JavaScript in Forms Creating simple JavaScripts 3. Click the Actions tab, choose Mouse Up, and then click Add. 4. Choose JavaScript from the Type menu, and then click Edit. 5. To specify go to the next page when the button is selected, in the script window, type in the following text in the exact format, and click OK: this.pageNum++;...
  • Page 59: Hiding A Field Until A Condition Is Met

    Using Acrobat JavaScript in Forms Creating simple JavaScripts 5. To mail the PDF document to the specified e-mail address when the button is selected, in the script window, enter the following text in the exact format, and click OK: " "...
  • Page 60: Working With Javascript Actions

    3. Select JavaScript as the action. For information about selecting an action for a form field, link, bookmark, or page action, see the section in the Acrobat online help, “Adding Navigation to Adobe PDF Documents” > “Using Actions for special effects” > “About action types”.
  • Page 61: Working With Document Level Javascript Actions

    Using Acrobat JavaScript in Forms Working with document level JavaScript actions 2. Type the name of the script in the text box. 3. Click Add. 4. Copy and paste a predefined custom script, or type the script in the text box provided, and then click OK.
  • Page 62: Creating Form Fields Programmatically

    Using Acrobat JavaScript in Forms Creating form fields programmatically Document Did Save runs the JavaScript after the document is saved. Document Will Print runs the JavaScript while the document is printed. Document Did Print runs the JavaScript after the document is printed. 3.
  • Page 63 Using Acrobat JavaScript in Forms Creating form fields programmatically There are seven types of form fields, described in detail in the following sections: Button List Box Signature Check Box Radio Button Text Combo Box A form field may be created either through the Form toolbar in the Acrobat UI, or by the method of the Object.
  • Page 64: Button

    Using Acrobat JavaScript in Forms Creating form fields programmatically All field types have the same properties availabe in the General tab of the Properties dialog. It is possible through the UI in Acrobat to specify the Appearance of the field, its Options and its Actions, all of which appear as tabs in the UI for a button field.
  • Page 65 Using Acrobat JavaScript in Forms Creating form fields programmatically Appearance Tab The Appearance tab allows you to set the basic appearance of the field. The table below summarizes how the appearance can be set programmatically using JavaScript. Region/Name See Reference Example Borders and Colors Border Color...
  • Page 66: Check Box

    Appearance Tab for buttons. There is one difference, however — there is no choice for textFont. In the case of a check box, the font is always Adobe Pi. Options Tab The Options tab allows you to set the style of check mark used in the field and the export value.
  • Page 67: Combo Box

    Using Acrobat JavaScript in Forms Creating form fields programmatically Table Notes. Check box is checked by default: After using defaultIsChecked, the field is not necessarily checked. To check the field, either reset the field, this.resetForm([f.name]), or apply the : f.checkThisBox(0); checkThisBox Check box is checked by default: To determine if the “Check box is checked by default”...
  • Page 68 Using Acrobat JavaScript in Forms Creating form fields programmatically Table Notes. Item and Export Value: After a combo box is created with addField. the item names their export values can easily be introduced using setItems; for example f.setItems([ ["California", "CA"], ["Ohio", "OH"], ["Arizona", "AZ"] ]);...
  • Page 69 Using Acrobat JavaScript in Forms Creating form fields programmatically Region/Name See Reference Example Time AFTime_Format() Special AFSpecial_Format() Custom see table notes Table Notes. Number: The example in the table corresponds to a comma delimited euro currency with two decimal points in the UI. Custom: Any format script that does not use the above mentioned format functions is classified as custom formatting script.
  • Page 70: List Box

    Using Acrobat JavaScript in Forms Creating form fields programmatically Calculate Tab The action of the combo box can be set with the field level and a trigger name setAction of "Calculate". The UI has three categories of Calculate, the JavaScript counterpart is the method, as listed in the table below.
  • Page 71: Radio Button

    Using Acrobat JavaScript in Forms Creating form fields programmatically Options Tab Options Tab show the same set of properties as the comobox, with the exception that Allow user to enter custom text and Check spelling are not available and Multiple selection is available.
  • Page 72: Signature

    Using Acrobat JavaScript in Forms Creating form fields programmatically Appearance Tab The Appearance tab shows the same set of properties as for buttons. For details, see the Appearance Tab for buttons. Options Tab Options Tab of a radio button field is the same as that of a check box. The Table Notes are applicable as well.
  • Page 73: Text

    = this.addField("mySignature", "signature", 0, [200, 500, 500, 400]); f.strokeColor = color.black; // set it to lock when signed f.setAction("Format", 'AFSignature_Format("THESE", new Array ("mySignature"));' ); var ppklite = security.getHandler("Adobe.PPKLite"); // choose handler ppklite.login("dps017", "/C/signatures/DPSmith.pfx"); // login f.signatureSign(ppklite, // sign it { password: "dps017",...
  • Page 74 Using Acrobat JavaScript in Forms Creating form fields programmatically Region/Name See Reference Example Default Value defaultValue f.defaultValue = "Name: "; Multiline multiline f.multiline = true; Scroll long text doNotScroll f.doNotScroll = true; Allow Rich Text Formatting richText f.richText = true; Limit of # characters charLimit f.charLimit = 40;...
  • Page 75: Appendix A A Short Acrobat Javascript Faq

    Document level By using the Adobe Acrobat menu item Advanced > JavaScript > Document JavaScripts…, you can add, modify, or delete document level scripts. These scripts should be function definitions that are generally useful to the document but are not applicable outside the document.
  • Page 76: Field Level

    A Short Acrobat JavaScript FAQ How should I name my form fields? within the PDF document. Therefore, the forms programmer should make every effort to package scripts as effectively as possible. FDF programmers should also be aware that FDF files can include document-level scripts and can also include scripts specified to be executed just before the FDF gets imported or executed right after the FDF gets imported.
  • Page 77: How Do I Use Date Objects

    A Short Acrobat JavaScript FAQ How do I use date objects? With our hierarchy of Name.First, Name.Middle and Name.Last above (and perhaps, Name.Title if used), we can change the background color of these fields with just two lines of code instead of six: var name = this.getfield("Name");...
  • Page 78 A Short Acrobat JavaScript FAQ How do I use date objects? To convert a Date object into a string, the printd of the Util Object is used. Unlike the built- in conversion of the Date object to a string, allows an exact specification of how printd the date should be formatted.
  • Page 79: Converting From A String To A Date

    A Short Acrobat JavaScript FAQ How do I use date objects? Converting from a string to a date To convert a string into a Date object the of the Util Object is used. It accepts a scand format string that it uses as a hint as to the order of the year, month, and day in the input string.
  • Page 80 A Short Acrobat JavaScript FAQ How do I use date objects? representation. Internally, JavaScript dates are stored as the number of milliseconds (one thousand milliseconds is one whole second) since a fixed date and time. This number can be retrieved through the valueOf method of the Date object. The Date constructor allows the construction of a new date from this number.
  • Page 81: How Can I Make My Document Secure

    A Short Acrobat JavaScript FAQ How can I make my document secure? How can I make my document secure? Security in Acrobat takes on the form of restricting access to a document, restricting permissions for a form once it has been opened, and digital signatures. Restricting Access to the Document If the author desires to restrict access to the form in its entirety then the standard security model in Acrobat can be selected and an open password defined that requires a user to...
  • Page 82: How Can I Make Restricted Acrobat Javascript Methods Available To Users

    ID. For details on where you can obtain digital IDs and the procedures for using them to sign documents, see “Creating a certifying signature” in Adobe Acrobat 6.0 Help. The recipient should trust the signer for certified documents and JavaScript.
  • Page 83: How Can I Make My Documents Accessible

    Beginning with the 4.05 release of Acrobat, Adobe has worked to allow motion and vision impaired users to fill out Acrobat Forms. Version 6 of Acrobat is more fully speech-enabled than ever.
  • Page 84: Short Description

    A Short Acrobat JavaScript FAQ How can I define globals in JavaScript? Short Description Every field that is not hidden must contain a user name (tooltip) that is user friendly. This name is spoken when a user acquires the focus to that field and should give an indication of the field’s purpose.
  • Page 85: Making Globals Persistent

    A Short Acrobat JavaScript FAQ How can I send form data to an e-mail address? Making Globals Persistent Global data does not persist across user sessions unless you specifically make your globals persistent. The predefined Global object has a method designed to do this. To make a variable named 'myVariable' persist across sessions, do this: global.setPersistent("myVariable",true);...
  • Page 86: How Can I Intercept Keystrokes One By One As They Occur

    A Short Acrobat JavaScript FAQ How can I intercept keystrokes one by one as they occur? Then, when your document (Document A) wants to access the value of interest from the other form (Document B), it can subscribe to the variable in question: global.subscribe("xyz_value", ValueUpdate);...
  • Page 87: How Can I Prompt The User For A Response In A Dialog

    A Short Acrobat JavaScript FAQ How can I prompt the user for a response in a dialog? How can I prompt the user for a response in a dialog? Use the defined in the App Object class. This method displays a dialog box response containing a question and an entry field for the user to reply to the question.
  • Page 88: How Can I Determine If The Mouse Has Entered/Left A Certain Area

    A Short Acrobat JavaScript FAQ How can I determine if the mouse has entered/left a certain area? How can I determine if the mouse has entered/left a certain area? Create an invisible, read-only text field at the place where you want to detect mouse entry or exit.
  • Page 89 Index Index Document JavaScripts command 55 document level JavaScript 7, 60 documents manipulating 15 Acrobat ECMAScript 12 applications 15 Editing Toolbar, Advanced 41 plug-in 12 editors 19 Acrobat Database Connectivity. See ADBC eForms 11 actions enabling JavaScript 27, 28 JavaScript 60 setting options 58 field level JavaScript 7, 60 with JavaScript 58...
  • Page 90 Index automatic date field 55 calculation 56 notation, simplified field 56 core 12 creating simple scripts 55 object hierarchies 15 deleting 61 objects document level 7, 60 See also JavaScript objects editors 19, 62 online team review 12 e-mailing a document 58 enabling 27, 28 PDF documents.

This manual is also suitable for:

Acrobat 6.0

Table of Contents