JavaScript objects from Acrobat supported in Designer ES2

本文详细介绍了在Adobe Designer ES2中,JavaScript对象与Acrobat之间的兼容性,包括常用属性、方法及其等效功能,以及如何在特定场景下使用这些功能。特别关注了不同对象如Annot、app、Bookmark、doc等的属性和方法,并提供了相应的示例代码,旨在帮助开发者更好地理解和应用这些技术。

JavaScript objects from Acrobat supported in Designer ES2

The following table lists the availability of the most commonly used Acrobat objects, properties, and methods in Designer ES2, and provides information on any equivalent functionality in Designer ES2. Although the table contains the most commonly used Acrobat objects, properties and methods, some are not listed, such as multimedia objects, because they are rarely used for forms.

In cases where no equivalent Designer ES2 functionality is listed, no direct Designer ES2 property or method can reproduce the Acrobat behavior. However, you can still create custom functions or scripts to replicate the Acrobat capability.

JavaScript in Acrobat

Designer ES2 support

JavaScript-equivalent in Designer ES2

Comments

Annot object properties and methods

All properties and methods

Yes

None

Only forms with a fixed layout support the annotation layer.

app object properties

calculate

No

None

Designer ES2 includes the execCalculatemethod which initiates the calculateevent.

language

Yes

xfa.host.language

See the languageproperty.

monitors

Yes

None

 

platform

Yes

xfa.host.platform

See the platformproperty.

plugins

Yes

None

 

toolbar

Yes

None

 

viewerType

Yes

xfa.host.appType

See the appTypeproperty.

viewerVariation

Yes

xfa.host.variation

See the variationproperty.

viewerVersion

Yes

xfa.host.version

See the versionproperty.

app object methods

addMenuItem

Yes

None

 

addSubMenu

Yes

None

 

addToolButton

Yes

None

 

alert

Yes

xfa.host.messageBox()

See the messageBoxmethod.

beep

Yes

xfa.host.beep()

See the beepmethod.

browseForDoc

Yes

None

 

clearInterval

Yes

None

 

clearTimeOut

Yes

None

 

execDialog

Yes

None

 

execMenuItem

Yes

None

Executes the specified menu command. Use this method in Designer ES2 for File menu commands.

getNthPluginName

Yes

None

 

getPath

Yes

None

 

goBack

Yes

None

 

goForward

Yes

None

 

hideMenuItem

Yes

None

 

hideToolbarButton

Yes

None

 

launchURL

Yes

None

Designer ES2 includes the gotoURLmethod that loads a specified URL into the client application, such as Acrobat or Adobe Reader.

listMenuItems

Yes

None

 

listToolbarButtons

Yes

None

 

mailGetAddrs

Yes

None

 

mailMsg

Yes

None

 

newDoc

Yes

None

This method can only be executed during batch, console, or menu events.

newFDF

No

None

 

openDoc

Yes

None

 

openFDF

No

None

 

popUpMenuEx

Yes

None

 

popUpMenu

Yes

None

 

removeToolButton

Yes

None

 

response

Yes

xfa.host.response()

See the responsemethod.

setInterval

Yes

None

 

setTimeOut

Yes

None

 

trustedFunction

Yes

None

 

trustPropagatorFunction

Yes

None

This method is only available during batch, console, and application initialization.

Bookmark object properties and methods

All properties and methods

Yes

None

 

doc object properties

author

Yes

None

 

baseURL

Yes

None

 

bookmarkRoot

Yes

None

 

calculate

No

None

 

dataObjects

Yes

None

 

delay

No

None

 

dirty

Yes

None

This JavaScript script for Designer ES2 saves a copy of a form and tests whether the form has changed:

var sOrigXML = xfa.data.saveXML; if (sOrigXML != xfa.data.saveXML)
{...}
disclosed

Yes

None

 

documentFileName

Yes

None

 

dynamicXFAForm

Yes

None

 

external

Yes

None

 

filesize

Yes

None

 

hidden

Yes

None

 

icons

Yes

None

 

keywords

Yes

None

 

layout

Yes

None

 

media

Yes

None

 

metadata

Yes

xfa.form.desc

See the descobject.

modDate

Yes

None

 

mouseX mouseY

Yes

None

 

noautocomplete

Yes

None

 

nocache

Yes

None

 

numFields

Yes

xfa.layout.pageContent()

The pageContentmethod returns a list of all objects of a particular type. However, you must execute the method for design views and master pages to scan the entire form.

numPages

Yes

xfa.host.numPages

or

xfa.layout.absPageCount() xfa.layout.pageCount()

The numPagesproperty returns the page count for the rendered form in the client. See also theabsPageCountand pageCountmethods.

pageNum

Yes

xfa.host.currentPage

See the currentPageproperty.

pageNum--

Yes

xfa.host.currentPage--

or

xfa.host.pageUp()

See the currentPageproperty or the pageUpmethod.

pageNum++

Yes

xfa.host.currentPage++

or

xfa.host.pageDown()

See the currentPageproperty or the pageDownmethod.

path

Yes

None

 

securityHandler

Yes

None

 

templates

No

None

Use subform objects in Designer ES2, and use properties and methods to add, remove, move, and set subform instances.

For more information, see Add and remove subform instances using scripting.

title

Yes

xfa.host.title

See the titleproperty.

doc object methods

addAnnot

Yes

None

 

addField

No

None

You must use forms that have a fixed layout in Designer ES2, and then use the instanceManager object to add, remove, and set the number of instances of a particular object.

For more information, see Add and remove subform instances using scripting.

addIcon

Yes

None

 

addLink

No

None

 

addRecipientListCryptFilter

Yes

None

 

addScript

Yes

None

 

addThumbnails

No

None

 

addWatermarkFromFile

Yes

None

 

addWatermarkFromText

Yes

None

 

addWeblinks

Yes

None

 

appRightsSign

Yes

None

 

appRightsValidate

Yes

None

 

bringToFront

Yes

None

 

calculateNow

No

xfa.form.recalculate(1);

or

execCalculate()

The recalculatemethod forces a specific set of scripts on calculateevents to initiate. Boolean value indicates whether True(default) - all calculation scripts initiate; orFalse - only pending calculation scripts initiate.

Designer ES2 calculate object controls whether a form filler can override a field's calculated value.

Alternatively, you can use the execCalculatemethod for each object for which you want to force a recalculation.

closeDoc

Yes

None

 

createDataObject

Yes

None

 

createTemplate

No

None

Designer ES2 forms do not have an equivalent to the concept of an Acrobat template. You must use subform objects in Designer ES2.

deletePages

No

None

In Designer ES2, you can use the instanceManagerobject to remove the subform object that represents a page of your form.

For more information, see Add and remove subform instances using scripting.

embedDocAsDataObject

Yes

None

 

encryptForRecipients

Yes

None

 

encryptUsingPolicy

Yes

None

 

exportAsText

Yes

None

This method is only available in the JavaScript Console of the JavaScript Debugger in Acrobat or during batch processing.

exportAsFDF

No

xfa.host.exportData()

The exportDatamethod exports an XML or XDP file instead of an FDF file.

exportAsXFDF

No

xfa.host.exportData()

The exportDatamethod exports an XML or XDP file instead of an FDF file.

exportDataObject

Yes

None

 

exportXFAData

No

xfa.host.exportData()

The exportDatamethod exports an XML or XDP file instead of an FDF file.

extractPages

No

None

 

flattenPages

Yes

None

 

getAnnot

Yes

None

 

getAnnots

Yes

None

 

getDataObjectContents

Yes

None

 

getField("FieldName")

Yes

xfa.resolveNode ("FieldName")

The resolveNodemethod accesses the specified object in the source XML of the form.

getLegalWarnings

Yes

None

 

getLinks

No

None

 

getNthFieldName

Yes

You must loop through all objects with a similar class name until you reach the nthoccurrence.

See the classNameproperty.

getNthTemplate

No

None

 

getOCGs

Yes

None

 

getOCGOrder

Yes

None

 

getPageBox

Yes

None

 

getPageLabel

Yes

None

 

getPageNthWord

Yes

None

 

getPageNthWordQuads

Yes

None

 

getPageNumWords

Yes

None

 

getPageRotation

Yes

None

 

getPrintParams

Yes

None

 

getTemplate

No

None

 

getURL

Yes

xfa.host.gotoURL( "http://www.adobe.com");

See the gotoURLmethod.

gotoNamedDest

No

None

 

importAnFDF

No

None

 

importAnXFDF

Yes

None

 

importDataObject

Yes

None

 

importIcon

Yes

None

 

importTextData

Yes

None

 

importXFAData

No

xfa.host.importData ("filename.xdp");

See the importDatamethod.

insertPages

No

None

 

mailDoc

Yes

None

 

mailForm

No

None

 

movePage

No

None

 

newPage

No

None

 

openDataObject

Yes

None

 

print

Yes

xfa.host.print();

See the printmethod.

removeDataObject

Yes

None

 

removeField

No

None

 

removeIcon

Yes

None

 

removeLinks

No

None

 

removeScript

Yes

None

 

removeTemplate

No

None

 

removeThumbnails

No

None

 

removeWeblinks

Yes

None

 

replacePages

No

None

 

resetForm

No

xfa.host.resetData()

or

xfa.event.reset()

The resetDatamethod resets all field values on a form to the default values. Theresetmethod resets all properties within the event model.

saveAs

Yes

None

In Designer ES2, the file must be saved at the application level. These scripts are examples of saving at the application level:

app.executeMenuItem ("SaveAs");

or

var myDoc = event.target; myDoc.saveAs();
spawnPageFromTemplate

No

None

 

setAction

No

None

 

setPageLabel

Yes

None

 

setPageRotation

No

None

 

setPageTabOrder

No

None

In Designer ES2, select Edit > Tab Order to set the tab order.

setScript

No

None

 

submitForm

Yes

Use one of the submit button objects in Designer ES2.

 

event object properties

change

Yes

xfa.event.change

See the change property.

targetName

Yes

xfa.event.target

See the target property.

field object properties

comb

No

None

 

charLimit

No

this.value.#text.maxChars

In forms that have a fixed layout, character limit can be set in the Designer ES2 workspace. You can set fields on forms whose layout expands to accommodate all data.

For more information, see maxChars.

display = display.noView

No

See Changing the presence of a form design object.

You can also set the presenceproperty in the Designer ES2 workspace.

You cannot use the prePrint event to change the presence of an object prior to printing.

display = display.noPrint

No

See Changing the presence of a form design object.

You can also set the presenceproperty in the Designer ES2 workspace.

You cannot use the prePrint event to change the presence of an object prior to printing.

defaultValue

No

None

Set the default field value in the Designer ES2 workspace.

exportValues

No

None

Set the export value in the Designer ES2 workspace.

fillColor

No

xfa.form.Form1.
NumericField1.fillColor

See the fillColorproperty.

hidden

No

this.presence = "invisible" this.
presence = "visible"

You can also set the presenceproperty in the Designer ES2 workspace.

multiline

No

this.ui.textEdit.multiLine
= "1";

See the multiLineproperty.

password

No

None

Designer ES2 contains a Password Field that you can use for passwords on a form.

page

No

None

Not applicable for Designer ES2 forms.

print

No

this.relevant = "-print";

See the relevantproperty.

radiosInUnison

No

None

Grouped radio buttons in Designer ES2 are mutually exclusive by default.

rect

Yes

You can get the height and width of a Designer ES2 form field by using the following reference syntax:

this.h; this.w;

Alternatively, you can retrieve the x and y coordinates of an object using the following reference syntax:

this.x; this.y;

See the h, w, x, and y properties.

required

No

this.mandatory = "error";

or

this.validate.nullTest = "error";

See the mandatoryandnullTestproperties.

textColor

No

this.fontColor

See the fontColorproperty.

textSize

No

this.font.size

See the sizeproperty.

textFont

No

this.font.typeface

See the typefaceproperty.

value

No

this.rawValue

See the rawValueproperty.

Designer ES2 fields have a valueproperty; it is not the equivalent of the Acrobatvalue property.

field object methods

clearItems

No

DropDownList1.clearItems();

The clearItemsmethod only applies to Drop-down List and List Box objects in Designer ES2.

deleteItemAt

No

None

 

getItemAt

No

None

 

insertItemAt

No

DropDownList1.addItem(
.....)

See the addItemmethod.

isBoxChecked

No

if(CheckBox1.rawValue
== 1)....

See the rawValueproperty.

isDefaultChecked

No

None

 

setAction

No

None

Not applicable for Designer ES2 forms.

setFocus

Yes

xfa.host.setFocus ("TextField1.somExpression")

The setFocusmethod requires that the specified object have a unique name with respect to other objects on your form.

setItems

No

None

 

setLock

Yes

None

 

signatureGetModifications

Yes

None

 

signatureGetSeedValue

Yes

None

 

signatureInfo

Yes

None

 

signatureSetSeedValue

Yes

None

 

signatureSign

Yes

None

 

signatureValidate

Yes

None

 

search object method

search.query("<your text>");

Yes

None

The ".." (double period) FormCalc shortcut syntax allows you to search for objects within the XML Form Object Model.

For more information, see FormCalc reference syntax shortcuts.

SOAP object method

All properties and methods

Yes

None

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值