Adobe ACROBAT FORMS JAVASCRIPT OBJECT Скачать руководство пользователя страница 43

Acrobat Forms - JavaScript Object Specification

43

This property allows you to access the fully qualified field name of the field as a string object.

var f = this.getField("MyField");

console.println(f.name);

numItems

Type: Integer

Fields: Combo & Listbox

Access: R

The number of items in the combo or list box.

password

Type: Boolean

Fields: Text

Access: R

This property causes the field to display asterisks for the data entered into the field. Upon
submission, the actual data entered is sent. Fields that have the password attribute set will not
have the data in the field saved when the document is saved to disk.

print

Type: Boolean

Fields: All

Access: R/W

This property determines whether a given field prints or not. Set the print property to true to
allow the field to appear when the user prints the document, set it to false to prevent printing.
This property can be used to hide control buttons and other fields that are not useful on the
printed page.

var f = this.getField("MyField");

f.print = false;

This property has been superseded by the

display

property and its use is discouraged.

readonly

Type: Boolean

Fields: All

Access: R/W

This property sets or gets the read-only characteristic of a field. If a field is read-only, the user
can see the field but cannot change it.

required

Type: Boolean

Fields: All but Button

Access: R/W

L

Содержание ACROBAT FORMS JAVASCRIPT OBJECT

Страница 1: ...bc Acrobat Forms JavaScript Object Specification Version 4 0 Adobe Acrobat Revised January 27 1999 Technical Note 5186...

Страница 2: ...er license and may only be used or copied in accordance with the terms of such license Adobe the Adobe logo Acrobat Acrobat Capture Acrobat Exchange and Distiller are trade marks of Adobe Systems Inco...

Страница 3: ...ormsVersion 10 fullscreen 10 language 11 numPlugIns 11 openInPlace 11 platform 12 toolbar 12 toolbarHorizontal 12 toolbarVertical 12 viewerType 12 viewerVersion 12 App Object Methods 13 alert 13 beep...

Страница 4: ...ields 22 numPages 22 numTemplates 22 path 22 pageNum 22 producer 23 subject 23 title 23 zoom 23 zoomType 24 Doc Object Methods 24 calculateNow 24 exportAsFDF 24 getField 25 getNthFieldName 25 getNthTe...

Страница 5: ...e 34 willCommit 35 Field Object 36 Field Access from JavaScript 36 Field Properties 36 alignment 37 borderStyle 38 calcOrderIndex 38 charLimit 39 defaultValue 39 delay 39 display 40 doc 40 editable 40...

Страница 6: ...Util Object Methods 53 printf 53 printx 53 printd 54 scand 55 Implementation Considerations 56 JavaScript Locations and Loading 56 Plug in folder level 56 Document level 56 Field level 57 Form Field H...

Страница 7: ...on JavaScript objects and on language syntax Portable Document Format Reference Manual version 1 2 or later describes the PDF representation of a form and its fields Appendix H describes the Forms Da...

Страница 8: ...is available only in versions of the Acrobat Forms software greater than or equal to Before accessing this object property or method the script should check that the application version is greater tha...

Страница 9: ...tGray Doc Object calculate delay external numFields exportAsFDF getNthFieldName getURL importAnFDF mailDoc mailForm spawnPageFromTemplate submitForm Field Object display setItems deleteItemAt Util Obj...

Страница 10: ...functions plus a variety of utility routines and convenience functions App Object Properties calculate Type Boolean Access R W If this property is set to true it will allow calculations to be performe...

Страница 11: ...full screen mode was initiated language Type String Access R This property defines the language of the running Acrobat Viewer It returns the following strings numPlugIns Type Number Access R This prop...

Страница 12: ...l Type Boolean Access R W This property allows a script to show or hide the Acrobat horizontal tool bar It does not hide the tool bar in external windows i e in an Acrobat window within a Web browser...

Страница 13: ...nally an icon type can be specified by using the nIcon parameter The following is a list of icons and their associated values Additionally a button group type can be specified This method returns the...

Страница 14: ...e is case sensitive and has to exactly match strings in the list Example This example executes File Open menu item It will display a dialog to the user asking for the file to be opened app execMenuIte...

Страница 15: ...buttons can be obtained from the Acrobat Viewer Plug In API On line Reference Technical Note 5168 See Other useful documents for more details hideToolbarButton Parameters cName Returns nothing This me...

Страница 16: ...om This is the subject This is the body of the mail Note This is a Windows only feature In addition the client machine must have its default mail program configured to be MAPI enabled in order to use...

Страница 17: ...Colors in the RGB color space are represented by three values the intensity of the red green and blue components in the output RGB is commonly used for video displays because they are generally based...

Страница 18: ...s negative else it sets it to black var f event target field that the event occurs at if event value 0 f textColor color red else f textColor color black Color Object Keyword Version Transparent color...

Страница 19: ...shows the console window hide Parameters none Returns none This method closes the console window println Parameters cMessage Returns none This method prints the string value of cMessage to the console...

Страница 20: ...xamples below illustrates the use of the Event object to access the Doc object of the underlying document In Mouse calculate validate format events var doc event target doc In all other events var doc...

Страница 21: ...o the field level delay property dirty Type Boolean Access R W This property identifies whether the document has been dirtied as the result of a changes to the document and therefore needs to be saved...

Страница 22: ...his property returns the total number of fields in the document See also the getNthFieldName method numPages Type Integer Access R This property contains the number of pages in the document numTemplat...

Страница 23: ...next page this pageNum producer Type String Access R This property contains producer of the document e g Acrobat Distiller PDFWriter etc subject Type String Access R W This property defines the docume...

Страница 24: ...all calculation fields in the current document exportAsFDF Parameters bAllFields bNoPassword aFields bFlags Returns nothing Use this method to export an FDF file to the local hard drive Upon invocati...

Страница 25: ...lse true name The example above illustrates a shortcut to exporting a whole subtree Passing name as part of the aFields parameter exports name title name first name middle and name last etc The option...

Страница 26: ...etails on named destinations and how to create them see the PDF Reference Manual Version 1 3 importAnFDF Parameters cFile Returns nothing This method imports the specified FDF file The cFile parameter...

Страница 27: ...m configured to be MAPI enabled in order to use this method mailForm Parameters bUI cTo cCc cBcc cSubject cMsgBody Returns nothing This method exports the form data and mails the resulting FDF file as...

Страница 28: ...to true if you don t want to display the cancel dialog box while the document is printing The default value for bSilent flag is false Example This Example will print current page the document is on th...

Страница 29: ...bRename is true Example var n this numTemplates var cTempl for i 0 i n i cTempl this getNthTemplate i this spawnPageFromTemplate cTempl Addition If bInsert is specified then the template is inserted...

Страница 30: ...erver cgi bin myscript cgi FDF true name The example above illustrates a shortcut to submitting a whole subtree Passing name as part of the field parameter submits name title name first name middle an...

Страница 31: ...that you perform very little processing i e play a short sound during this event A mouse down event will not occur unless a mouse enter event has already occurred Mouse Up The mouse up event is trigg...

Страница 32: ...en committed so that a JavaScript can verify that the value entered was correct If the validate event is successful the next event triggered is the calculate event Calculate The calculate event causes...

Страница 33: ...e was committed by tabbing to a new field For example to automatically display an alert dialog after a field has been committed add the following to the field s format script if event commitKey 0 app...

Страница 34: ...t shift Type Boolean Event Keystroke Mouse events Access R This property is a boolean that specifies whether the shift key is down during a particular event target Type Object Event All events Access...

Страница 35: ...ains the value that the user has committed For example the following JavaScript formats the field as a currency type of field event value util printf 2f event value willCommit Type Boolean Event Keyst...

Страница 36: ...e More than one variable may be bound to a field by modifying the field s object properties or accessing its methods This affects all variables bound to that field var f doc getField Total This exampl...

Страница 37: ...Field MyText f alignment center highlight String lineWidth Integer lineWidth Boolean name String numItems Integer password Boolean print Boolean readonly Boolean required Boolean strokeColor Array sty...

Страница 38: ...ic convenience constant that defines all the border styles of a field The following example illustrates how to set the border style of a field to solid var f this getField MyField f borderStyle border...

Страница 39: ...value that the field is set to when the form is reset delay Type Boolean Fields All Access R W This property delays the redrawing of a field s appearance It is generally used to buffer a series of cha...

Страница 40: ...hether the user can type in a selection or must choose one of the provided selections var f this getField MyComboBox f editable true fillColor Type Array Fields All Access R W This property specifies...

Страница 41: ...ter versions highlight Type String Fields Button Access R W This property defines how a button reacts when a user clicks it The four highlight modes supported are none invert push and outline The none...

Страница 42: ...t by using the integer values below For example Change the border width of the Text Box to medium thickness f lineWidth 2 The default value for lineWidth is 1 thin Any integer value can be used Howeve...

Страница 43: ...eld saved when the document is saved to disk print Type Boolean Fields All Access R W This property determines whether a given field prints or not Set the print property to true to allow the field to...

Страница 44: ...ays section for information on defining color arrays and how values are used with this property In older versions of this specification this property was borderColor The use of borderColor is now disc...

Страница 45: ...on this property was fgColor The use of fgColor is now discouraged but for backwards compatibility is still valid textFont Type String Fields Text Combo List Button Access R W The textFont property de...

Страница 46: ...ar f this getField MyField f textSize 28 type Type String Fields All Access R This read only property returns the type of the field as a string Valid types that are returned include button checkbox co...

Страница 47: ...a button from another PDF file It prompts the user to select a PDF file available on the system clearItems Parameters none Returns nothing This method clears all the values in a list box or combo box...

Страница 48: ...the index of the item in the list to obtain If nIndex is set to 1 it returns the value of the last item in the list The getItemAt function returns the exported or internal value of the item at nIndex...

Страница 49: ...the user and export values for the list item are equal to the string If the element is an array it must consist of two sub elements The first sub element should be convertible to a string which will b...

Страница 50: ...Manual For example to remove the property volume from the global object call the following script delete global volume Global Object Methods setPersistent parameters cVariable bPersist Returns none T...

Страница 51: ...llisions with other persistent global variable names throughout the documents Note that global variables that are persistent are recorded in the plug in level glob js file upon application exit and re...

Страница 52: ...console println Page doc page The following script outputs the current page number to the console twice and then prints the page PrintPageNum this Must pass the document object console println Page th...

Страница 53: ...This method formats a source string according to a masking string Valid masking values are as follows To format a string as a U S telephone number for example use the following script var v aaa1415969...

Страница 54: ...th Sept mm Numeric month with leading zero 09 m Numeric month without leading zero 9 dddd Long day Wednesday ddd Abbreviated day Wed dd Numeric date with leading zero 03 d Numeric date without leading...

Страница 55: ...ctly Turn the current date into a string var cDate util printd mm dd yyyy new Date console println Today s date cDate Parse it back into a date var d util scand mm dd yyyy cDate Output it in reverse o...

Страница 56: ...d functions and AFString js which contains the language dependent strings needed by Aform js The file glob js is programmatically generated and contains cross session application preferences set using...

Страница 57: ...FirstName to Name First and LastName to Name Last we form a tree of fields The period separator used in Acrobat Forms and denotes a hierarchy shift The Name portion of these fields is the parent and...

Страница 58: ...tions that process dates JavaScript Date objects are actually an object containing both a date and time All references to date in this section refer to the date time combination Note All date manipula...

Страница 59: ...s with a four digit year to avoid ambiguity Converting a String to a Date To convert a string into a Date object the scand method of the Util Object is used It accepts a format string that it uses as...

Страница 60: ...ate will be several days or weeks in the future The JavaScript Date object provides several ways to do this The simplest and possibly most easily understood method is by manipulating dates in terms of...

Страница 61: ...24 13 Create our new date that is 13 days ahead of the current date var d2 new Date num Print out the current date and our new date using util printd console println It is currently util printd mm dd...

Страница 62: ...changes to its formulae or internal data routines If the changing the document restriction is selected the user can fill in form fields and add annotations but cannot author or modify form fields or c...

Страница 63: ...ture field that all fields whose names starts with A are locked and all fields whose names start with B are locked We might start with a script fragment to be executed at signature time looking someth...

Страница 64: ...Acrobat Forms JavaScript Object Specification 64 AFSignatureLock this THESE B bLock See the comments in AForm js for more details...

Отзывы: