data-id=javascript-apis
data-id=id1
JavaScript APIs
data-id=53810
data-id=alerter
data-id=id2
Alerter
The Acrobat multimedia plug-in displays error alerts under various conditions such as a missing media file. JavaScript code can customize these alerts, either for an entire document or for an individual media player.
In an alert situation, the internal function app.media.alert is called with parameters containing information about the alert. The app.media.alert method handles the alert by looking for alerter objects and calling their dispatch methods, in this order:
args.alerter
doc.media.alerter
doc.media.stockAlerter
To handle alerts for a specific player, provide an alerter object in args.alerter when you call app.media.createPlayer or app.media.openPlayer.
To handle alerts for an entire document, set doc.media.alerter to an alerter object.
All alerts can be suppressed for a player or document by setting args.alerter or doc.media.alerter to null.
doc.media.stockAlerter provides the default alerts that are used if a custom alerter is not specified. This property is initialized automatically by app.media.alert. Normally, doc.media.stockAlerter would not be referenced in developer code.
data-id=alerter-methods
data-id=id3
Alerter methods
data-id=41501
data-id=dispatch
data-id=id4
dispatch
Called by app.media.alert to handle alert situations.
Parameters
alertAn Alert object (see below).
Returns
A Boolean value, true to stop further alert processing, false to continue processing.
data-id=41949
Alert object
typedocfromUsererrormessage property: error: { message: String }errorTextfileNameselectionMediaSelection objectExample 1: Open a media player and suppress all alerts for this player.
app.media.openPlayer({ alerter: null });
// A more elaborate way to do the same thing
app.media.openPlayer(
{
alerter:
{
dispatch() { return true; }
}
});
Example 2: For all players in this document, log any alerts to a text field and allow the normal alert box to be displayed.
function logAlerts( doc )
{
count = 0;
doc.alerter =
{
dispatch( alert )
{
doc.getField("AlertLog").value += "Alert #"
+ ++count + ": " + alert.type + "n";
}
}
}
logAlerts( this );
// Another way to keep the counter
function logAlerts( doc )
{
doc.alerter =
{
count = 0,
dispatch( alert )
{
doc.getField("AlertLog").value += "Alert #"
+ ++this.count + ": " + alert.type + "n";
}
}
}
logAlerts( this );
Example 3: Handle the PlayerError alert here, with defaults for other alerts.
this.media.alerter =
{
dispatch( alert )
{
switch( alert.type )
{
case "PlayerError":
app.alert( "Player error: " + alert.errorText );
return true;
}
}
}
data-id=15210
data-id=alternatepresentation
data-id=id5
AlternatePresentation
This object provides an interface to the document’s particular alternate presentation. Use the Doc object method alternatePresentations to acquire an AlternatePresentation object.
See the PDF Reference for additional details on alternate presentations.
data-id=alternatepresentation-properties
data-id=id6
AlternatePresentation properties
data-id=45263
data-id=active
data-id=id7
active
This property is true if the presentation is currently active and false otherwise. When a presentation is active, it controls how the document that owns it is displayed.
Example: See the start method for an example.
data-id=39659
data-id=type
data-id=id8
type
The type of the alternate presentation. Currently, the only supported type is “SlideShow”.
data-id=alternatepresentation-methods
data-id=id9
AlternatePresentation methods
data-id=63957
data-id=start
data-id=id10
start
Switches the document view into the alternate presentation mode and sets the active property to true. An exception is thrown if this or any other alternate presentation is already active.
Parameters
cOnStopstop, an explicit user action, or the presentation logic itself).cCommandExample: Assume there is a named presentation called “MySlideShow” within the document.
// oMySlideShow is an AlternatePresentation object
oMySlideShow = this.alternatePresentations.MySlideShow;
if (!oMySlideShow.active) oMySlideShow.start();
Note that this.alternatePresentations is used to access the specified presentation by property name.
data-id=40183
data-id=stop
data-id=id11
stop
Stops the presentation and switches the document into normal (PDF) presentation. An exception is thrown if this presentation is not active.
Example: In this example, oMySlideShow is an AlternatePresentations object. See start for a related example.
// Stop the show if already active
if (oMySlideShow.active) oMySlideShow.stop();
data-id=49491
data-id=bookmark
data-id=id237
Bookmark
A Bookmark object represents a node in the bookmark tree that appears in the bookmarks navigational panel. Bookmarks are typically used as a table of contents allowing the user to navigate quickly to topics of interest.
data-id=bookmark-properties
data-id=id238
Bookmark properties
data-id=98065
data-id=children
data-id=id239
children
nullAn array of Bookmark objects that are the children of this bookmark in the bookmark tree. If there are no children of this bookmark, this property has a value of null.
See also the parent and bookmarkRoot properties.
Example: Dump all bookmarks in the document.
function DumpBookmark(bkm, nLevel)
{
var s = "";
for (var i = 0; i < nLevel; i++) s += " ";
console.println(s + "+-" + bkm.name);
if (bkm.children != null)
for (var i = 0; i < bkm.children.length; i++)
DumpBookmark(bkm.children[i], nLevel + 1);
}
console.clear(); console.show();
console.println("Dumping all bookmarks in the document.");
DumpBookmark(this.bookmarkRoot, 0);
data-id=71326
data-id=color
data-id=id240
color
Specifies the color for a bookmark. Values are defined by using gray, RGB or CMYK color. See Color arrays for information on defining color arrays and how values are used with this property. See also the style property.
Example: The following fun script colors the top-level bookmark red, green, and blue.
var bkm = this.bookmarkRoot.children[0];
bkm.color = color.black;
var C = new Array(1, 0, 0);
var run = app.setInterval(
'bkm.color = ["RGB",C[0],C[1],C[2]]; C.push(C.shift());', 1000);
var stoprun=app.setTimeOut(
"app.clearInterval(run); bkm.color=color.black",12000);
data-id=40682
data-id=id241
data-id=id242
doc
The Doc that the bookmark resides in.
data-id=76081
data-id=id243
data-id=id244
name
The text string for the bookmark that the user sees in the navigational panel.
Example: Put the top-level bookmark in bold.
var bkm = this.bookmarkRoot.children[0];
console.println( "Top-level bookmark name: " + bkm.name );
The example that follows the children property also uses the name property.
data-id=57280
data-id=open
data-id=id245
open
Determines whether the bookmark shows its children in the navigation panel (open) or whether the children subtree is collapsed (closed).
data-id=36697
data-id=parent
data-id=id246
parent
nullThe parent bookmark of the bookmark or null if the bookmark is the root bookmark. See also the children and bookmarkRoot properties.
data-id=86167
data-id=id247
data-id=id248
style
Specifies the style for the bookmark’s font: 0 is normal, 1 is italic, 2 is bold, and 3 is bold-italic. See also the color property.
Example: The following code puts the top-level bookmark in bold.
var bkm = this.bookmarkRoot.children[0];
bkm.style = 2;
data-id=bookmark-methods
data-id=id249
Bookmark methods
data-id=81576
data-id=createchild
data-id=id250
createChild
Creates a new child bookmark at the specified location.
See also the children property and the insertChild and remove methods.
Parameters
cNamecExprnIndexExample: Create a bookmark at the top of the bookmark panel that takes you to the next page in the document.
this.bookmarkRoot.createChild("Next Page", "this.pageNum++");
data-id=81661
data-id=execute
data-id=id251
execute
Executes the action associated with this bookmark. This can have a variety of behaviors. See the PDF Reference for a list of common action types. See also the createChild method.
Example: Implement a simple search of the bookmarks. If successful, the action associated with the bookmark is executed.
// Document-level or folder-level JavaScript.
function searchBookmarks(bkm, nLevel, bkmName)
{
if ( bkm.name == bkmName ) return bkm;
if (bkm.children != null) {
for (var i = 0; i < bkm.children.length; i++)
{
var bkMark = searchBookmarks(
bkm.children[i], nLevel + 1, bkmName);
if ( bkMark != null ) break;
}
return bkMark;
}
return null;
}
// Redefine this function for a more sophisticated compare.
function bmkCompare( name1, name2 )
{
return ( name1 == name2 );
}
The following code initiates the search. This code could be executed as field-level JavaScript or be executed as a menu action.
var bkmName = app.response({
cQuestion: "Enter the name of the bookmark to find",
cTitle: "Bookmark Search and Execute"
});
if ( bkmName != null ) {
var bkm = searchBookmarks(this.bookmarkRoot, 0, bkmName );
if ( bkm != null ) bkm.execute();
else app.alert("Bookmark not found");
}
data-id=61060
data-id=insertchild
data-id=id253
insertChild
Inserts the specified bookmark as a child of this bookmark. If the bookmark already exists in the bookmark tree, it is unlinked before inserting it back into the tree. In addition, the insertion is checked for circularities and disallowed if one exists. This prevents users from inserting a bookmark as a child or grandchild of itself. See also the children property and the createChild and remove methods.
Parameters
oBookmarknIndexExample: Take the first child bookmark and move it to the end of the bookmarks.
var bm = bookmarkRoot.children[0];
bookmarkRoot.insertChild(bm, bookmarkRoot.children.length);
data-id=43068
data-id=remove
data-id=id254
remove
Removes the bookmark and all its children from the bookmark tree. See also the children property and the createChild and insertChild methods.
Example: Remove all bookmarks from the document.
bookmarkRoot.remove();
data-id=52228
data-id=setaction
data-id=id255
setAction
Sets a JavaScript action for a bookmark.
See also the Doc addRequirement and setPageAction methods and the Field object setAction method.
Note
This method overwrites any action already defined for this bookmark.
Parameters
cScriptExample: Attach an action to the topmost bookmark.
var bm = bookmarkRoot.children[0]
bm.setAction("app.beep(0);");
data-id=33812
data-id=catalog
data-id=id256
catalog
A static object that accesses the functionality provided by the Acrobat Catalog plug-in. This plug-in must be installed to interface with the catalog object.
Note
The Catalog plug-in (and the
catalogobject) is available only in Acrobat Pro.
See also the Index object, which is used to invoke various indexing operations provided by the Catalog plug-in, and the CatalogJob object.
data-id=catalog-properties
data-id=id257
catalog properties
data-id=59187
data-id=isidle
data-id=id258
isIdle
Returns true when Catalog is not busy with an indexing job.
data-id=22300
data-id=jobs
data-id=id259
jobs
Gets information about the Catalog jobs. Catalog maintains a list of its pending, in-progress, and completed jobs for each Acrobat session. Returns an array of CatalogJob objects.
data-id=catalog-methods
data-id=id260
catalog methods
data-id=87258
data-id=getindex
data-id=id261
getIndex
Uses a specified path of a Catalog index to get an Index object. The returned object can be used to perform various indexing operations such as building or deleting an index.
Parameters
cDIPathReturns
The Index object.
data-id=37233
data-id=id262
data-id=id263
remove
Removes the specified CatalogJob object from Catalog’s job list. Catalog maintains a list of pending, in-progress, and completed jobs for each Acrobat session.
Parameters
oJobCatalogJob object to remove, as returned by the jobs property and various methods of the Index object.Example: Delete all jobs that are pending and need complete rebuild.
if (typeof catalog != undefined) {
for (var i=0; i<catalog.jobs.length; i++){
var job = catalog.jobs[i];
console.println("Index: ", job.path);
if (job.status == "Pending" && job.type == "Rebuild")
catalog.remove(job);
}
}
data-id=13857
data-id=catalogjob
data-id=id264
CatalogJob
This generic JavaScript object provides information about a job submitted to Catalog. It is returned by the build method of the Index object and the catalog.jobs property, and passed to catalog.remove.
data-id=catalogjob-properties
data-id=id265
CatalogJob properties
data-id=49309
data-id=path
data-id=id266
path
Device-independent path of the index associated with the job
data-id=58696
data-id=id267
data-id=id268
type
Type of indexing operation associated with the job.
Possible values are:
Build
Rebuild
Delete
data-id=20317
data-id=id269
data-id=id270
status
The status of the indexing operation.
Possible values are:
Pending
Processing
Completed
CompletedWithErrors
data-id=44855
data-id=certificate
data-id=id271
Certificate
The Certificate object provides read-only access to the properties of an X.509 public key certificate.
Related objects and methods are:
securityobject: importFromFile and getSecurityPoliciesDirConnectionobject: search
Field object: signatureInfo * FDF object: signatureValidate * RDN object
- Usage Object
Note
There are no security restrictions on this object.
data-id=certificate-properties
data-id=id272
Certificate properties
data-id=96257
data-id=binary
data-id=id273
binary
The raw bytes of the certificate, as a hex encoded string.
data-id=20527
data-id=issuerdn
data-id=id274
issuerDN
RDN objectThe distinguished name of the issuer of the certificate, returned as an RDN object.
data-id=87992
data-id=keyusage
data-id=id275
keyUsage
An array of strings indicating the value of the certificate key usage extension. Possible values are
kDigitalSignature kDataEncipherment kCRLSign
kNonRepudiation kKeyAgreement kEncipherOnly
kKeyEncipherment kKeyCertSign kDecipherOnly
data-id=40392
data-id=md5hash
data-id=id276
MD5Hash
The MD5 digest of the certificate, represented as a hex-encoded string. This provides a unique fingerprint for this certificate.
data-id=62254
data-id=privatekeyvalidityend
data-id=id277
privateKeyValidityEnd
The date before which it’s legal to use the private key associated with this certificate. If the PKUP extension is not present or this property isn’t present in the extension, this represents the validity end date of the certificate itself. Before a digital ID can be used for signing, Acrobat ensures that the signing time is prior to the privateKeyValidityEnd date.
data-id=63122
data-id=privatekeyvaliditystart
data-id=id278
privateKeyValidityStart
The date after which it’s legal to use the private key associated with this certificate. If the Private Key Usage Period (PKUP) certificate extension is not present, this represents the validity start date of the certificate itself. Before a digital ID can be used for signing, Acrobat ensures that the signing time is more recent than the privateKeyValidityStart date.
data-id=34510
data-id=sha1hash
data-id=id279
SHA1Hash
The SHA1 digest of the certificate, represented as a hex-encoded string. This provides a unique fingerprint for this certificate.
data-id=68894
data-id=serialnumber
data-id=id280
serialNumber
A unique identifier for this certificate, used in conjunction with issuerDN.
data-id=31991
data-id=subjectcn
data-id=id281
subjectCN
The common name of the signer.
data-id=23415
data-id=subjectdn
data-id=id282
subjectDN
RDN objectThe distinguished name of the signer, returned as an RDN object.
data-id=50891
data-id=ubrights
data-id=id283
ubRights
The application rights that can be enabled by this certificate, returned as a generic Rights object.
data-id=36240
Rights Object
A Rights object has the following properties.
moderightsdata-id=81656
data-id=usage
data-id=id284
usage
The purposes for which this certificate may be used within the Acrobat environment returned as a Usage object.
data-id=87917
Usage Object
This generic JavaScript object represents a certificate usage value in the certificate.usage property. It has the following properties.
endUserSigningtrue if the certificate is usable for end-user signing.endUserEncryptiontrue if the certificate is usable for end-user encryption.Example: Encrypt the currently open document for everyone in the address book. Address book entries that contain sign-only certificates, CA certificates, no certificates, or are otherwise unsuitable for encryption, are not included in the final recipient list.
var eng = security.getHandler( "Adobe.AAB" );
var dc = eng.directories[0].connect();
var recipients = dc.search();
var filteredRecipients = new Array();
for( i = 0; i < recipients.length; ++i ) {
if( recipients[i].defaultEncryptCert &&
recipients[i].defaultEncryptCert.usage.endUserEncryption ) {
filteredRecipients[filteredRecipients.length] = recipients[i];
continue;
}
if(recipients[i].certificates) {
for( j = 0; j < recipients[i].certificates.length; ++j )
if( recipients[i].certificates[j].usage.endUserEncryption ) {
filteredRecipients[filteredRecipients.length]
= recipients[i];
continue;
}
}
}
this.encryptForRecipients({
oGroups:[{userEntities: filteredRecipients}]
});
data-id=74572
data-id=validityend
data-id=id285
validityEnd
The validity end date of the certificate. Before a digital ID can be used for signing, Acrobat ensures that the signing time is prior to the validityEnd date.
data-id=55071
data-id=validitystart
data-id=id286
validityStart
The validity start date of the certificate. Before a digital ID can be used for signing Acrobat, ensures that the signing time is more recent than the validityStart date.
data-id=29350
data-id=collab
data-id=id287
Collab
This static object represents the collaboration functionality.
data-id=collab-methods
data-id=id288
Collab methods
data-id=49904
data-id=addstatemodel
data-id=id289
addStateModel
Adds a new state model to Acrobat. A state model describes the valid states that an annotation using the model can have (see the Annotation object for details about getting and setting the state of an annotation). State models can be used to describe the workflow that a document review goes through and can be used for review management.
See also removeStateModel, getStateInModel, and transitionToState.
Parameters
cNamecUINameoStatesStates object.cDefaultbHiddenfalse (the State Model is shown).bHistorytrue.data-id=10552
States object
This generic object represents a set of states in a state model and is passed as the oStates parameter. The elements in the object literal are the unique state identifiers and the values are objects having the following properties:
cUINameoIconIcon Stream object that is displayed in the UI for the state.Example: Add a new state model with a unique name of “ReviewStates”:
Collab.addStateModel({
cName: "ReviewStates",
cUIName: "My Review",
oStates:
{
"initial": {cUIName: "Haven't reviewed it"},
"approved": {cUIName: "I approve"},
"rejected": {cUIName: "Forget it"},
"resubmit": {cUIName: "Make some changes"}
},
cDefault: "initial"
});
A state model can be removed with Collab.removeStateModel.
data-id=77375
data-id=documenttostream
data-id=id290
documentToStream
Saves a copy of a Doc and returns the contents as a stream object.
The document dirty property is preserved after this method is called and the original document is not modified.
Parameters
oDocumentReturns
A ReadStream object.
data-id=90340
data-id=removestatemodel
data-id=id291
removeStateModel
Removes a state model that was previously added by calling addStateModel. Removing a state model does not remove the state information associated with individual annotations. If the model is removed and added again, all of the state information for the annotations is still available.
See also addStateModel, getStateInModel, and transitionToState.
Parameters
cNameaddStateModel.Example: Continuing the example in addStateModel, remove the state model “ReviewStates”:
// Remove the state model
Collab.removeStateModel("ReviewStates");
data-id=37083
data-id=id292
data-id=id293
color
The color object is a convenience static object that defines the basic colors. Use this object to set a property or call a method that requires a color array.
data-id=98898
data-id=color-arrays
data-id=id294
Color arrays
A color is represented in JavaScript as an array containing 1, 2, 4, or 5 elements corresponding to a Transparent, Gray, RGB, or CMYK color space, respectively. The first element in the array is a string denoting the color space type. The subsequent elements are numbers that range between zero and one inclusive. For example, the color red can be represented as ["RGB", 1, 0, 0].
Invalid strings or insufficient elements in a color array cause the color to be interpreted as the color black.
data-id=color-properties
data-id=id295
color properties
The color object defines the following colors.
color.transparent[ "T" ]color.black[ "G", 0 ]color.white[ "G", 1 ]color.red[ "RGB", 1,0,0 ]color.green[ "RGB", 0,1,0 ]color.blue[ "RGB", 0, 0, 1 ]color.cyan[ "CMYK", 1,0,0,0 ]color.magenta[ "CMYK", 0,1 0,0 ]color.yellow[ "CMYK", 0,0,1,0 ]color.dkGray[ "G", 0.25 ]color.gray[ "G", 0.5 ]color.ltGray[ "G", 0.75 ]Example: This example sets the text color of the field to red if the value of the field is negative, or to black if the field value is nonnegative.
var f = event.target; /* field that the event occurs at */
f.target.textColor = event.value < 0 ? color.red : color.black;
data-id=color-methods
data-id=id296
color methods
- convert
- equal
data-id=16408
data-id=convert
data-id=id297
convert
Converts the color space and color values specified by the color object to the specified color space:
- Conversion to the gray color space is lossy (in the same fashion that displaying a color TV signal on a black-and-white TV is lossy).
- The conversion of RGB to CMYK does not take into account any black generation or undercolor removal parameters.
Parameters
colorArraycColorspaceReturns
A color array.
Example: The return value of the code line below is the array ["CMYK", 0, 1, 1, 0].
color.convert(["RGB",1,0,0], "CMYK");
data-id=10606
data-id=equal
data-id=id298
equal
Compares two Color Arrays to see if they are the same. The routine performs conversions, if necessary, to determine if the two colors are indeed equal (for example, ["RGB",1,1,0] is equal to ["CMYK",0,0,1,0]).
Parameters
colorArray1colorArray2Returns
true if the arrays represent the same color, false otherwise.
Example:
var f = this.getField("foo");
if (color.equal(f.textColor, f.fillColor))
app.alert("Foreground and background color are the same!");
data-id=40112
data-id=colorconvertaction
data-id=id299
colorConvertAction
This object describes a single color conversion action.
You can obtain colorConvertAction object from the Doc object method getColorConvertAction. The returned object can then be modified. A color conversion action is divided into a “match” section and an “action” section. The “match” section describes what sorts of objects can match this action. The Doc object method colorConvertPage, accepts an array of these actions, against which matches are attempted until a match is found.
data-id=colorconvertaction-properties
data-id=id300
colorConvertAction properties
data-id=60292
data-id=action
data-id=id301
action
Describes the action to perform if a match occurs.
The value of action is accessed through the constants.actions object of the colorConvertAction object as the following constants:
constants.actions object
PreserveConvertDecalibrateDownConvertdata-id=95592
data-id=alias
data-id=id302
alias
If this action is an ink action then this describes the ink’s alias.
data-id=66014
data-id=colorantname
data-id=id303
colorantName
If this action is an ink action then this describes the colorant name.
See the related property isProcessColor.
data-id=41068
data-id=convertintent
data-id=id304
convertIntent
Defines the rendering intent used to color convert the object. For a detailed description of rendering intents, please see Table 4.20 of the PDF Reference.
The value of convertIntent is accessed through the constants.renderingIntents object of the colorConvertAction object.
data-id=84007
data-id=convertprofile
data-id=id305
convertProfile
Describes the color profile to which matching objects should be converted if the action is Convert. A list of available color profiles can be obtained from the printColorProfiles property of the app object
data-id=29705
data-id=embed
data-id=id306
embed
If the matched object is to be converted and embed is true, the resulting object will have a color profile embedded in the file. Otherwise, the object will be stored as the corresponding device color space for the profile to which the object was converted.
data-id=85716
data-id=isprocesscolor
data-id=id307
isProcessColor
If this action is an ink action and if isProcessColor is true, the ink represents a process color, and the colorantName should be one of Cyan, Magenta, Yellow, Black, Red, Green or Blue.
data-id=68063
data-id=matchattributesall
data-id=id308
matchAttributesAll
The value of the matchAttributesAll property is a bitmap containing object attributes (flags) to be matched. A match occurs if all flags match, i.e. if there is a complete match.
The flags are accessed through the constants.objectFlags object of the colorConvertAction object and are defined as follows:
data-id=47626
constants.objectFlags object
ObjImageObjJPEGObjJPEG2000ObjLossyObjNonLossyObjTextObjLineArtObjShadeObjTransparentObjOverprintingObjOverprintModeNote
The value of
matchAttributesAllcan be set by using the bitwise operators with the bit flags ofconstants.objectFlags.
Example: Match images that overprint.
var action = this.getColorConvertAction();
action.matchAttributesAll = action.constants.objFlags.ObjImage
action.constants.objFlags.ObjOverprinting;
data-id=55787
data-id=matchattributesany
data-id=id309
matchAttributesAny
The value of the matchAttributesAny property is a bitmap containing object attributes to be matched. A match occurs if any of the flags match.
The flags are accessed through the constants.objectFlags object of the colorConvertAction object.
Note
The value of
matchAttributesAnycan be set by using the bitwise operators with the bit flags ofconstants.objectFlags.
data-id=23732
data-id=matchintent
data-id=id310
matchIntent
Matches the rendering intent used for the object. For a detailed description of rendering intents, please see Table 4.20 of the PDF Reference.
The value of matchIntent is accessed through the constants.renderingIntents object of the colorConvertAction object and are defined as follows:
data-id=56390
constants.renderingIntents object
AbsoluteColorimetricRelativeColorimetricSaturationPerceptualAnyDocumentdata-id=45157
data-id=matchspacetypeall
data-id=id311
matchSpaceTypeAll
The value of the matchSpaceTypeAll property is a bitmap containing color space attributes (flags) to be matched. A match occurs if all flags match, i.e. if there is a complete match.
These two fields are bitmaps containing color space attributes to be matched. The first field will only match if all flags match, i.e. if there is a complete match. The second field will match if any of the flags match.
The flags are accessed through the constants.spaceFlags object of the colorConvertAction object and are defined as follows:
data-id=76159
constants.spaceFlags object
DeviceSpaceCalibratedSpaceAlternateSpaceBaseSpaceIndexedSpaceSeparationSpaceDeviceNSpaceNChannelSpaceRGBSpaceDeviceSpace or CalibratedSpace.CMYKSpaceDeviceSpace or CalibratedSpace.GraySpaceDeviceSpace or CalibratedSpace.LabSpaceCalibratedSpace.Note
The value of
matchSpaceTypeAllcan be set by using the bitwise operators with the bit flags ofconstants.spaceFlags.
data-id=78757
data-id=matchspacetypeany
data-id=id312
matchSpaceTypeAny
The value of the matchSpaceTypeAny property is a bitmap containing color space attributes (flags) to be matched. A match occurs if any of the flags match.
The flags are accessed through the constants.spaceFlags object of the colorConvertAction object.
Note
The value of
matchSpaceTypeAnycan be set by using the bitwise operators with the bit flags ofconstants.spaceFlags.
data-id=36011
data-id=preserveblack
data-id=id313
preserveBlack
If the matched object is to be converted and preserveBlack is true, the conversion will be done using a “black-preserving” transform, in which text or line art objects are handled specially. If a CMYK color is (0.0, 0.0, 0.0, 1.0), an RGB color is (0.0, 0.0, 0.0) or a gray color is (0.0), and preserveBlack is true, that color is considered special-case black, and is converted straight to black without using the conversion profile. The resulting color will be as described for the matching black color for the corresponding profile target color space, for example, if the convert profile is RGB, the resulting color will be (0.0, 0.0, 0.0) no matter what the color profile says.
data-id=66694
data-id=useblackpointcompensation
data-id=id314
useBlackPointCompensation
If useBlackPointCompensation is true, use black point compensation for all color conversions. The effect of this flag depends on the color management method (CMM) being used, but if the Adobe CMM is being used, colorimetric transforms are scaled such that black remains black no matter what the media black point of the source profile.
data-id=26749
data-id=collection
data-id=id315
Collection
A collection object is obtained from the Doc. collection property. Doc. collection returns a null value when there is no PDF collection (also called PDF package and PDF portfolio).
The collection object is used to set the initial document in the collection, set the initial view of the collection, and to get, add, and remove collection fields (or categories).
data-id=collection-properties
data-id=id316
Collection properties
data-id=67804
data-id=fields
data-id=id317
fields
The fields property is an array of collectionField objects in the collection.
Example: Enumerate all the collectionFields in a collection.
for (var i in collection.fields)
console.println(i);
data-id=10634
data-id=initialdoc
data-id=id318
initialDoc
Use the initialDoc property to specify the document in the collection that is initially viewed when the collection is opened. The value of initialDoc is the name property of the Data object of the initial document, or null if no initial document is specified.
Example: Set the initial document to the third file in the collection.
this.collection.initialDoc = this.dataObjects[2].name;
data-id=11002
data-id=initialview
data-id=id319
initialView
A string describing the initial collection view. Possible values include Tile, Details, Hidden, Custom, or null. The values of Tile and Details are built-in views, while Custom indicates that a document-based Navigator is preferred.
Example: Set the initial view to Details.
this.collection.initialView = "Details";
data-id=collection-methods
data-id=id320
Collection methods
data-id=23829
data-id=addfield
data-id=id321
addField
Adds a new field (or category) to the collection schema. The method throws an exception if the field already exits.
nametexttypeS, a string type. A field with a string value. D, a date type. A field with a date value. N, a numeric type. A field with a numeric value. The following values identify the types of file-related fields: F, a field reserved for the file name of a member of the collection. Desc, a field reserved for a description string of a member of the collection. Size, a ield reserved for the file size of a member of the collection. ModDate, a field reserved for the modification date of a member of the collection. CreationDate, a field reserved for the creation date of a member of the collection. CompressedSize, a field reserved for the compressed file size of a member of the collection. The default is "S", a string type.ordervisibletrue ; not visible if false. The default is true.readOnlytrue. The default is false. If a field is read only, the user is not allowed to change the value of this field through the user interface.Returns
The collectionField object of the newly created field.
Example: Create a new field in the collection called "to" using object literal techniques.
this.collection.addField({name:"to", order:3, text:"To", type:"S"});
// The same example as above, but using ordered parameters.
this.collection.addField("to", "To", "S", 3);
data-id=87286
data-id=getfield
data-id=id322
getField
The getField method returns the collectionField object corresponding to the name of a collection field.
Parameters
namecollectionField object to be retrieved.Returns
A collectionField object, or null if the field is not found.
Example: Get the collectionField object of the "from" field.
var f = this.collection.getField("from");
data-id=70653
data-id=removefield
data-id=id323
removeField
Remove a field from the collection schema.
Parameters
nameExample: Remove the "from" field from the collection schema.
this.collection.removeField("from");
data-id=31572
data-id=collectionfield
data-id=id324
collectionField
The properties of the collectionField object are the fields (or categories) used by the collection. The text property (see below) is the (display) string the user sees in the user-interface with viewing a listing of the files files in the collection. Use the collectionField object to set the order the fields are listed in the user-interface, the sort order of the listing of the files, or to set a field as read only.
The collection field values for embedded files in the collection can be got or set through getFieldValue and setFieldValue methods of the Data object.
data-id=collectionfield-properties
data-id=id325
collectionField properties
data-id=50349
data-id=id326
data-id=id327
name
The string that specifies the name of the field.
data-id=70457
data-id=order
data-id=id328
order
Specifies the order the field is listed in relation to other fields. Field order is 0-based. When changing the value, if needed, the order of other fields will be incremented to prevent duplicates.
data-id=30423
data-id=id329
data-id=id330
readOnly
A Boolean value that specifies whether the user may change values of the field in the user interface. When readonly is true, no changes are allowed.
data-id=94450
data-id=sort
data-id=id331
sort
The value of sort specifies how this field contributes to the ordering of files in the collection.
If the value is 0, this field is not used to sort the files. If the absolute value is 1, this field is the primary sort field. If the absolute value is 2, the field is the secondary sort field (used to break ties on the primary sort field), and so on. Additionally, the sign of value indicates the direction in which the files should be sorted. Positive values indicate that the files are sorted in ascending order, and negative values indicate that files are sorted in descending order.
Example: To illustrate the sorting scheme, consider a simple set of 4 fields that describe an email inbox: From, Subject, To, and Received. Each file in the collection represents a single email message. Set the sort order for each of these fields as indicated below:
From:0To:0Subject:1Received:-2
The above sort order indicates that the primary sort field is "Subject" (the absolute value of the field is 1) and that files should be sorted in ascending order (the sign is positive). If two files have the same subject, the secondary sort field is consulted. In this case, the secondary sort field is "Received" (the absolute value of the field is 2) and it is specified to sort in descending order. The files are sorted by Subject in ascending order. Any files that have identical Subjects will be sorted in a subgroup by their Received field, but in descending order. The other fields do not contribute to the sort, since they are 0.
data-id=56468
data-id=text
data-id=id332
text
The value of text specifies the display text used by the field in the user-interface.
data-id=20646
data-id=id333
data-id=id334
type
A text string that specifies the type of data stored in the field. Possible values include:
S, the value of this field is a string type.D, the value of this field is a date type.N, the value of this field is a number type.F, the value of this field is the file name of a member of the collection.Desc, the value of this field is a description string of a member of the collection.Size, the value of this field is the file size of a member of the collection.ModDate, the value of this field is the modification date of a member of the collection.CreationDate, the value of this field is the creation date of a member of the collection.CompressedSize, the value of this field is the compressed file size of a member of the collection.
The value of this property cannot be changed for a field that already exists. When a new field is created using the addField method, the type can be set.
Example: Modify and examine the properties of user-defined field "from".
var f = this.collection.getField("from");
f.visible = true;
f.order = 1;
f.text = "From";
console.println("Field name: " + f.name);
console.println("Field type: " + f.type);
data-id=78269
data-id=column
data-id=id335
Column
This generic JavaScript object contains the data from every row in a column. A column object is returned by the getColumn and getColumnArray methods of the Statement object. See also the ColumnInfo object.
data-id=column-properties
data-id=id336
Column properties
data-id=53313
data-id=columnnum
data-id=id337
columnNum
START HERE
The number identifying the column.
data-id=16818
data-id=id338
data-id=id339
name
The name of the column.
data-id=15970
data-id=id340
data-id=id341
type
One of the SQL Types for the data in the column.
data-id=45830
data-id=typename
data-id=id342
typeName
The name of the type of data the column contains.
data-id=56665
data-id=value
data-id=id343
value
The value of the data in the column, in the format in which the data was originally retrieved.
data-id=73870
data-id=columninfo
data-id=id344
ColumnInfo
This generic JavaScript object contains basic information about a column of data. It is returned by the getColumnList method of the Connection object. See also the Column object.
data-id=columninfo-properties
data-id=id345
ColumnInfo properties
data-id=87257
data-id=id346
data-id=id347
name
A string that represents the identifying name of a column. This string can be used in a call to the getColumn method of the Statement object identify the associated column.
data-id=33941
data-id=description
data-id=id348
description
A string that contains database-dependent information about the column.
data-id=62088
data-id=id349
data-id=id350
type
A numeric value identifying one of the ADBC SQL Types that applies to the data contained in the column associated with the ColumnInfo object.
data-id=22487
data-id=id351
data-id=id352
typeName
A string identifying the type of the data contained in the associated column. It is not one of the SQL Types (see type above), but a database-dependent string representing the data type. This property may give useful information about user-defined data types.
data-id=92099
data-id=console
data-id=id353
console
The console object is a static object that enables access to the Acrobat JavaScript Console for executing JavaScript and displaying debug messages.
This object does not function in Adobe Reader versions earlier than 7.0. Beginning with version 7.0, Adobe Reader has a console window. Its primary function is to report errors and messages. This capability is controlled by the JavaScript preference Show Console on Errors and Messages. Though the console is not interactive, the methods of the console object function as they do in Acrobat.
The debugging capability of the Acrobat JavaScript Debugging window can be made available for Adobe Reader for the Windows and Mac OS platforms. To debug within Adobe Reader, the JavaScript file debugger.js must be installed and the Windows registry must be edited appropriately. See the JavaScript Developer Guide for technical details.
See also the dbg object.
data-id=console-methods
data-id=id354
console methods
data-id=68659
data-id=clear
data-id=id355
clear
Clears the console windows buffer of any output.
data-id=70690
data-id=hide
data-id=id356
hide
Closes the console window.
data-id=92823
data-id=println
data-id=id357
println
Prints a string value to the console window with an accompanying carriage return.
Parameters
cMessageExample 1: This example prints the value of a field to the console window. The script could be executed during a mouse-up event.
var f = this.getField("myText");
console.clear(); console.show();
console.println("Field value = " + f.value);
Example 2: The console can be used as a debugging tool. For example, you can write values of variables to the console. The following script is at the document level:
var debugIsOn = true;
function myFunction ( n, m )
{
if (debugIsOn)
{
console.println("Entering function: myFunction");
console.println(" Parameter 1: n = " + n);
console.println(" Parameter 2: m = " + m);
}
....
....
if (debugIsOn) console.println(" Return value: rtn = " + rtn);
return rtn;
}
Beginning with Acrobat 6.0, debugging can also be accomplished with the JavaScript Debugger. See the dbg object.
data-id=54323
data-id=show
data-id=id358
show
Shows the console window.
Example: Clear and show the console window:
console.clear();
console.show();
data-id=69212
data-id=data
data-id=id359
Data
The Data object is the representation of an embedded file or data stream that is stored in the document. See the PDF Reference for details.
Using Data objects is a good way to associate and embed source files, metadata, and other associated data with a document. Data objects can be inserted from the external file system, queried, and extracted.
See the following Doc properties and methods:
- createDataObject, dataObjects, exportDataObject, getDataObject, importDataObject, removeDataObject, openDataObject, getDataObjectContents, and setDataObjectContents.
The following objects, properties and methods support PDF portfolios (also called PDF collections or PDF packages):
app.newCollection, Doc. collection, Collection object, and collectionField object
Note
The Data object methods were implemented in Acrobat 5.0. However, the ability to use them in Adobe Reader with additional usage rights only became available in Adobe Reader 6.0.
data-id=data-properties
data-id=id361
Data properties
data-id=35317
data-id=id362
data-id=id363
creationDate
The creation date of the file that was embedded.
data-id=89891
data-id=id364
data-id=id365
description
The description associated with this data object.
data-id=45643
data-id=id366
data-id=id367
MIMEType
The MIME type associated with this data object.
data-id=17649
data-id=id368
data-id=id369
modDate
The modification date of the file that was embedded.
data-id=27704
data-id=id370
data-id=id371
name
The name associated with this data object.
Example: Display the names of file attachments to this document.
console.println("Dumping all data objects in the document.");
var d = this.dataObjects;
for (var i = 0; i < d.length; i++)
console.println("DataObject[" + i + "]=" + d[i].name);
data-id=11291
data-id=id372
data-id=id373
path
The file name and extension of the file that was embedded.
data-id=68523
data-id=id374
data-id=id375
size
The size, in bytes, of the uncompressed data object.
data-id=data-methods
data-id=id376
Data methods
data-id=72277
data-id=getfieldvalue
data-id=id377
getFieldValue
Get the value of the field as specified by the name parameter for this embedded file. When attempting to get a field value that is not defined in the collection schema, null is returned.
Parameters
nameincludePrefixtrue, the prefix is included with the return string. The default is false.Returns
The value of the field, or null if field is not present in schema.
data-id=16110
data-id=setfieldvalue
data-id=id378
setFieldValue
Type conversion is performed when setting field values. The type conversion is determined by the collectionField in the schema. When attempting to set a field value that is not defined in the schema, an exception is raised.
Parameters
namename not present in schema.valueReturns
The value of the field, or null if field is not present in schema.
Example: Get and set field values of the first data object in this collection.
var d = this.dataObjects[0];
d.setFieldValue("subject", "New laptop!", "RE: ");
// Now get the same field value we just set. Here s = "RE: New laptop!"
var s = d.getFieldValue({ name:"subject", includePrefix:true });
// Get the same field value, with includePrefix set to false, the default
// Now the value of s is "New laptop!".
s = d.getFieldValue("subject");
// Sets subject to "A. C. Robat" and clears prefix
d.setFieldValue("subject", "A. C. Robat");
data-id=80986
data-id=datasourceinfo
data-id=id379
DataSourceInfo
This generic JavaScript object contains basic information about a database. The ADBC.getDataSourceList method returns an array of these objects.
data-id=datasourceinfo-properties
data-id=id380
DataSourceInfo properties
data-id=59989
data-id=id381
data-id=id382
name
A string that represents the identifying name of a database. This string can be passed to newConnection to establish a connection to the database that the DataSourceInfo object is associated with.
data-id=21861
data-id=id383
data-id=id384
description
A string that contains database-dependent information about the database.
data-id=65262
data-id=dbg
data-id=id385
dbg
The dbg object is a static object that can be used to control the JavaScript Debugger from a command-line console. Its methods provide the same functionality as the buttons in the JavaScript Debugger dialog box toolbar. In addition, breakpoints can be created, deleted, and inspected using the dbg object.
The dbg object and the JavaScript Debugger are only available in Acrobat Pro.
Note
If the viewer locks up during a debugging session, pressing Esc may resolve the problem.
Debugging is not possible with a modal dialog box open; for example, when debugging a batch sequence.
Debugging a script with a running event initiated by either app.setInterval or app.setTimeOut may cause recurring alert boxes to appear. Use Esc after the modal dialog box is dismissed to resolve the problem.
(Acrobat 7.0) While the Debugger is open and a debugging session is under way, the Acrobat application is unavailable.
data-id=dbg-properties
data-id=id386
dbg properties
data-id=45894
data-id=bps
data-id=id387
bps
An array of breakpoint generic objects corresponding to breakpoints set in the debugger. This object contains the following properties and methods.
fileNameconditionlineNumtoStringExample: List all currently active breakpoints.
var db = dbg.bps
for ( var i = 0; i < db.length; i++ )
{
for ( var o in db[i] ) console.println(o + ": " + db[i][o]);
console.println("------------------------------------");
}
See sb for another example of usage.
data-id=dbg-methods
data-id=id388
dbg methods
data-id=24979
data-id=c
data-id=id389
c
The c (continue) method resumes execution of a program stopped in the debugger. The JavaScript program may either stop again, depending on where the breakpoints are set, or reach execution end.
data-id=54263
data-id=cb
data-id=id390
cb
The cb (clear breakpoint) method clears a breakpoint in the debugger. The dbg.cb method dirties the document only if breakpoints are stored in the document, as set through the user preferences, Edit > Preferences > JavaScript.
Parameters
fileNamelineNumdata-id=14994
data-id=q
data-id=id391
q
The q (quit) method quits debugging and executing the current JavaScript. It additionally dismisses the debugger dialog box.
data-id=85448
data-id=sb
data-id=id392
sb
The sb (set breakpoint) method sets a new breakpoint in the debugger. The dbg.sb method dirties the document only if breakpoints are stored in the document, as set through the user preferences, Edit > Preferences > JavaScript.
Parameters
fileNamelineNumconditiontrue, the debugger stops at the breakpoint. If the expression evaluates to false, the debugger continues executing the script and does not stop at the breakpoint. The default value is true.Example 1: Some script is run and an exception is thrown due to some error. A breakpoint is programmatically set using the information given in the error message.
SyntaxError: missing ; before statement 213:Document-Level: myDLJS
// now set a breakpoint using the console
dbg.sb({
fileName: "Document-Level: myDLJS",
lineNum: 213,
condition: "true"
});
Example 2: Simulate the functionality of the Store Breakpoints in PDF File check box in the JavaScript user preferences.
// Save breakpoints in PDF file
this.addScript("myBreakpoints", "var myBPS = " + dbg.bps.toSource());
// Now reset the breakpoints
for ( var i = 0; i < myBPS.length; i++ ) dbg.sb( myBPS[i] );
Example 3: Set a conditional break. Consider the following code, which is a mouse-up action.
for (var i=0; i<100; i++)
myFunction(i); // defined at document level
// In the console, set a conditional break. Here, we break when the
// index of the loop is greater than 30.
dbg.sb({
fileName:"AcroForm:Button1:Annot1:MouseUp:Action1",
lineNum:2,
condition:"i > 30"
})
data-id=70905
data-id=si
data-id=id393
si
The si (step in) method advances the program pointer to the next instruction in the JavaScript program, entering each function call for which there is a script defined. (Native JavaScript calls cannot be stepped into.)
data-id=67180
data-id=sn
data-id=id394
sn
The sn (step instruction) method advances the program pointer to the next bytecode in the JavaScript program. (Each JavaScript instruction is made up of several bytecodes as defined by the JavaScript interpreter.)
data-id=47502
data-id=so
data-id=id395
so
The so (step out) method executes the program until it exits the current function. Execution stops at the instruction immediately following the call to the current function. If the scope currently under debug is the top-level scope, the program either continues executing until it ends or stops again when it reaches a breakpoint.
data-id=92782
data-id=sv
data-id=id396
sv
The sv (step over) method advances the program pointer to the next instruction in the JavaScript program. If a function call is encountered, the debugger does not step into the instructions defined inside that function.
data-id=26032
data-id=dialog
data-id=id397
Dialog
An instance of this object is passed as a parameter to dialog box handlers (see Dialog box handlers). These handlers include the initialize, validate, commit, destroy and ItemID methods of the dialog box descriptor object literal that is passed to app.execDialog. The Dialog object allows the current state of the Dialog to be queried and set.
data-id=dialog-methods
data-id=id398
Dialog methods
data-id=83122
data-id=enable
data-id=id399
enable
Enables or disables various dialog box elements using the object literal passed in.
Typically, enable is called in the initialize method (see Dialog box handlers) of the object literal passed to app.execDialog to preset whether various dialog box elements are enabled or not.
Parameters
Example: See the examples following app. execDialog.
data-id=99912
data-id=end
data-id=id400
end
Terminates a currently executing dialog box (as if the Cancel button had been pressed). This method takes an optional parameter of the ItemID, a string, of the dialog box element that will be reported as dismissing the dialog. This ItemID will be the return value of the app.execDialog call that created the dialog.
Parameters
Example: See the examples following app. execDialog.
data-id=32700
data-id=load
data-id=id401
load
Sets the values of dialog box elements using the object literal passed in. Dialog box items are identified by an ItemID which is a unique 4-character string.
Typically, load is called in the initialize method (see Dialog box handlers) of the object literal passed to app.execDialog to preset the value of various dialog box elements.
Parameters
list_box or a popup), the value should be an object literal consisting of the displayed entry as the label and a numeric value as the contents. Similarly, if the dialog box element is hierarchical in nature (for example, a hier_list_box), the value should be a set of nested object literals. If the numeric value is greater than 0, the item is selected, otherwise it is not selected.Example: See the examples following app. execDialog.
data-id=63111
data-id=store
data-id=id402
store
Gets the values of dialog box elements as an object literal returned. Dialog box items are identified by an ItemID, which is a unique 4-character string. For each dialog box element, there will be an entry in the object literal with the ItemID as the label and the dialog box element setting as the contents. If the dialog box element takes multiple values (for example, a list_box or a popup), the value should be an object literal consisting of the displayed entry as the label and a numeric value as the contents. If the numeric value is greater than 0, the item was selected, otherwise it was not selected.
Typically, store is called in the commit method (see Dialog box handlers) of the object literal passed to app.execDialog to extract the value of various dialog box elements.
Returns
object literal
data-id=70131
data-id=dirconnection
data-id=id403
DirConnection
This object represents an open connection to a directory: a repository of user information, including public-key certificates. Directory connections are opened using the Directory object connect method. A directory with a particular name can have more than one connection open at a time. All DirConnection objects must support all properties and methods listed here, unless otherwise specified.
Note
This object can only be obtained from a
Directoryobject and is thus governed by the security restrictions of theDirectoryobject. TheDirConnectionobject is therefore available only for batch, console and application initialization, including in Adobe Reader. See also priv.
data-id=dirconnection-properties
data-id=id404
DirConnection properties
data-id=61351
data-id=canlist
data-id=id405
canList
Indicates whether the directory connection is capable of listing all of its entries. Some directories may contain too many entries for this operation to be practical.
Example: The AAB directory allows listing of the local trusted identity list.
var sh = security.getHandler( "Adobe.AAB" );
var dc = sh.directories[0].connect();
console.println( "CanList = " + dc.canList );
data-id=54768
data-id=candocustomsearch
data-id=id406
canDoCustomSearch
Specifies whether the directory connection supports searching using directory-specific search parameter attributes. For example, directory-specific attributes for an LDAP directory include o (organization), c (country), cn (common name), givenname, sn (surname), uid, st, postalcode, mail, and telephonenumber.
data-id=19446
data-id=candocustomuisearch
data-id=id407
canDoCustomUISearch
Specifies whether the directory connection supports searching using its own custom user interface to collect the search parameters.
data-id=64521
data-id=candostandardsearch
data-id=id408
canDoStandardSearch
Specifies whether the directory connection supports search using standard search parameter attributes. The standard attributes are
firstName
lastName
fullName
email
certificates
Some directory database implementations may not support these attributes, but directory handlers are free to translate these attributes to names understood by the directory.
data-id=38818
data-id=groups
data-id=id409
groups
An array of language-dependent names for groups that are available through this connection.
data-id=68524
data-id=id410
data-id=id411
name
The language-independent name of the directory that this object is connected to. An example of this would be Adobe.PPKMS.ADSI.dir0. All DirConnection objects must support this property.
data-id=66947
data-id=uiname
data-id=id412
uiName
The language-dependent string of the directory this object is connected to. This string is suitable for user interfaces. All DirConnection objects must support this property.
data-id=dirconnection-methods
data-id=id413
DirConnection methods
data-id=65566
data-id=search
data-id=id414
search
Searches the directory and returns an array of UserEntity objects that match the search parameters. A UserEntity object is a generic object that contains properties for all attributes that were requested by the setOutputFields method. If the setOutputFields method is not called prior to a search, it would return a UserEntity object containing no entries.
Parameters
oParamsoParams is not provided and canList is true for this directory, all entries in the directory will be returned. If oParams is not provided and canList is false, an exception occurs.cGroupNameGroup objects). If specified, the search will be restricted to this group.bCustomfalse (the default), oParams contains standard search attributes. If true, oParams contains directory-specific search parameters. If the canDoCustomSearch property is not true, an exception occurs.bUItrue, the handler displays the user interface to allow collection of search parameters. The results of the search are returned by this method. canDoCustomUISearch must also be true if bUI is true, or an exception will occur. If bUI is specified, bCustom must also be specified, though its value is ignored.Returns
An array of UserEntity objects.
Example 1: Directory search.
var sh = security.getHandler( "Adobe.PPKMS" );
var dc= sh.directories[0].connect();
dc.setOutputFields( {oFields:["certificates","email"]} )
var retVal = dc.search({oParams:{lastName:"Smith"}});
if( retVal.length )
console.println( retVal[0].email );
Example 2: List all entries in a local Acrobat Address Book. The script searches the directory and returns an array of users, along with their certificate information.
var sh = security.getHandler( "Adobe.AAB" );
var dc = sh.directories[0].connect();
if( dc.canList ) {
var x = dc.search();
for( j=0; j<x.length; ++j ) {
console.println("Entry[" + j + "] = " + x[j].fullName + ":");
for(i in x[j]) console.println(" " + i + " = " + x[j][i]);
}
}
data-id=45615
UserEntity object
A generic JavaScript object that describes a user in a directory and the user’s associated certificates. It contains standard properties that have a specific meaning for all directory handlers. Directory handlers translate these entries to the ones that are specific to them when required. An array of these objects is returned by the search method of the DirConnection object.
It has the following properties
firstNamelastNamefullNamecertificatesCertificate objectskeyUsage property.defaultEncryptCertCertificate objectsdata-id=89710
data-id=setoutputfields
data-id=id415
setOutputFields
Defines the list of attributes that should be returned when executing the search method.
Note
This method is not supported by the Adobe.AAB directory handler. Custom options are not supported by the Adobe.PPKMS.ADSI directory handler.
Parameters
oFieldsUserEntity object. Directory handlers can, when needed, translate standard attribute names to names that it understands.bCustomoFields are standard output attribute names. If true, the names represent directory-specific attributes that are defined for a particular directory handler. The default is false.Returns
An array of strings, containing the names of attributes from oFields that are not supported by this directory. An empty array is returned if the oFields array is empty.
Example: In this example, dc.setOutputFields returns the array of strings ["x", "y"].
var sh = security.getHandler("Adobe.PPKMS");
var dc = sh.directories[0].connect();
var w = dc.setOutputFields( [ "certificates", "email", "x", "y"] );
console.println( w );
See also the examples that follow the DirConnection.search method.
data-id=60701
data-id=directory
data-id=id416
Directory
Directories are a repository of user information, including public-key certificates. Directory objects provide directory access and are obtained using the directories property or the newDirectory method of the SecurityHandler object.
Acrobat 6.0 and later provides several directories. The Adobe.AAB Security Handler has a single directory named Adobe.AAB.AAB. This directory provides access to the local Acrobat Address Book, also called the trusted identity store. On Windows, the Adobe.PPKMS Security Handler provides access through the Microsoft Active Directory Script Interface (ADSI) to as many directories as have been created by the user. These directories are created sequentially with names Adobe.PPKMS.ADSI.dir0, Adobe.PPKMS.ADSI.dir1, and so on.
Note
This object can only be obtained from a
SecurityHandlerobject and is thus governed by the security restrictions of theSecurityHandlerobject. The Directory object is therefore available only for batch, console and application initialization, including in Adobe Reader. See also priv.
data-id=directory-properties
data-id=id417
Directory properties
data-id=53347
data-id=info
data-id=id418
info
The value of this property is a DirectoryInformation object, a generic object used to set and get the properties for this Directory object.
Example:
// Create and activate a new directory
var oDirInfo = { dirStdEntryID: "dir0",
dirStdEntryName: "Employee LDAP Directory",
dirStdEntryPrefDirHandlerID: "Adobe.PPKMS.ADSI",
dirStdEntryDirType: "LDAP",
server: "ldap0.example.com",
port: 389 };
var sh = security.getHandler( "Adobe.PPKMS" );
var newDir = sh.newDirectory();
newDir.info = oDirInfo;
data-id=56624
DirectoryInformation object
A directory information object is a generic object representing the properties for a directory and has the following standard properties.
dirStdEntryIDdirStdEntryNamedirStdEntryPrefDirHandlerIDdirStdEntryDirTypedirStdEntryVersion0x00010000.Directory information objects can include additional properties that are specific to a particular directory handler. The Adobe.PPKMS.ADSI directory handler includes the following additional properties:
serverportsearchBasemaxNumEntriestimeoutExample 1: Create and activate a new directory.
var oDirInfo = { dirStdEntryID: "dir0",
dirStdEntryName: "Employee LDAP Directory",
dirStdEntryPrefDirHandlerID: "Adobe.PPKMS.ADSI",
dirStdEntryDirType: "LDAP",
server: "ldap0.example.com",
port: 389
};
var sh = security.getHandler( "Adobe.PPKMS" );
var newDir = sh.newDirectory();
newDir.info = oDirInfo;
Example 2: Get information for an existing directory.
var sh = security.getHandler("Adobe.PPKMS");
var dir0 = sh.directories[0];
// Get directory info object just once for efficiency
var dir0Info = dir0.info;
console.println( "Directory " + dir0Info.dirStdEntryName );
console.println( "address " + dir0Info.server + ":" + dir0Info.port );
data-id=directory-methods
data-id=id419
Directory methods
data-id=36168
data-id=connect
data-id=id420
connect
Returns a DirConnection object that is a connection to the directory with the specified name. There can be more than one active connection for a directory.
See also the DirConnection object and the SecurityHandler object’s directories property.
Parameters
oParamsuserid and password.bUIfalse. It specifies whether the directory handler can bring its UI, if required for establishing the connection.Returns
A DirConnection object, or null if there is no directory with the specified name.
Example: Enumerate available directories and connect.
var sh = security.getHandler( "Adobe.PPKMS" );
var dirList = sh.directories;
for ( var i=0; i< dirList.length; i++)
for ( var o in dirList[i].info )
console.println( o + " = " + dirList[i].info[o]);
var dirConnection = dirList[0].connect();
data-id=92005
data-id=embedded-pdf
data-id=id421
Embedded PDF
This object describes an API exposed to the object model of a container application that allows sending and receiving messages from an embedded PDF document. For example, when a PDF document is embedded in an HTML document using the <OBJECT> tag, the PDF object is scripted in the browser scripting context.
The HostContainer object provides the corresponding interface in the PDF scripting model. Both the container and PDF document must explicitly allow this communication to occur for security reasons.
data-id=embedded-pdf-properties
data-id=id422
Embedded PDF properties
data-id=71300
data-id=messagehandler
data-id=id423
messageHandler
This property allows a script running in the web browser scripting context to register a notification object that will be called if a script in the PDF document calls the Doc hostContainer.postMessage method.
The value of this property is an object that may expose the following methods.
onMessagehostContainer.postMessage method. The message is delivered asynchronously. The method is passed a single array parameter containing the array passed to the postMessage method.onErrorname property of the Error object will be set to one of the following strings: - “MessageGeneralError”: A general error occurred. - “MessageNotAllowedError”: The operation failed for security reasons. - “MessageDocNotDisclosedError”: The document has not been configured for disclosure to the host container. The hostContainer.messageHandler.onDisclose property of the Doc must be initialized correctly. - “MessageDocRefusedDisclosureError”: The document has refused to disclose itself to the host container based on the URL because the hostContainer.messageHandler.onDisclose method returned false.When the methods are invoked, the this object will be the messageHandler instance that the method is being called on. Properties on the messageHandler property that begin with on are reserved for future use as notification methods.
If the PDF document has had the postMessage method called on it prior to this method being registered, all of the queued messages will subsequently be passed to the messageHandler object once it is set.
Messages are guaranteed to be delivered in the order in which they are posted and errors are guaranteed to be delivered in the order in which they occurred. However, there is no correspondence between the delivery order of messages and errors.
Exceptions thrown from within the handler methods will be discarded. Messages and errors will not be delivered while inside an onMessage / onError handler.
Note
This property is not implemented on the Mac OS platform.
data-id=embedded-pdf-methods
data-id=id424
Embedded PDF methods
data-id=48590
data-id=postmessage
data-id=id425
postMessage
Sends a message asynchronously to the PDF document message handler if the PDF document has disclosed itself by returning true from the onDisclosed method of the HostContainer object messageHandler property.
The message is passed to the onMessage method of the messageHandler.
If the PDF document does not disclose itself to the host container, an error will be passed to the onError method of the messageHandler property at some later point after postMessage has returned. If the PDF document has not registered to receive events by setting the Doc hostContainer.messageHandler property, the events will be queued until the PDF document sets the property.
The messages will be submitted to a queue of messages until they are delivered. If the queue size exceeds a maximum, an error will be thrown until some of the messages in the queue have been delivered.
Parameters
aMessageonMessage.Note
This method is not implemented on the Mac OS platform.
data-id=13935
data-id=error
data-id=id426
Error
Error objects are dynamically created whenever an exception is thrown from methods or properties implemented in JavaScript. Several subclasses of the Error object can be thrown by core JavaScript (EvalError, RangeError, SyntaxError, TypeError, ReferenceError, URLError). They all have the Error object as prototype. JavaScript can throw some of these exceptions, or implement subclasses of the Error object at its convenience. If your scripts are using the mechanism of try/catch error handling, the object thrown should be one of the types listed in the following table.
RangeErrorTypeErrorReferenceErrorMissingArgErrorNumberOfArgsErrorInvalidSetErrorInvalidGetErrorOutOfMemoryErrorNotSupportedErrorNotSupportedHFTErrorNotAllowedErrorGeneralErrorRaiseErrorDeadObjectErrorHelpErrorError object types implemented by JavaScript inherit properties and methods from the core Error object. Some JavaScript objects may implement their own specific types of exception. A description of the Error subclass (with added methods and properties, if any) should be provided in the documentation for the particular object.
Example: Print all properties of the Error object to the console.
try {
app.alert(); // one argument is required for alert
} catch(e) {
for (var i in e)
console.println( i + ": " + e[i])
}
data-id=error-properties
data-id=id427
Error properties
data-id=50406
data-id=filename
data-id=id428
fileName
The name of the script that caused the exception to be thrown.
data-id=67199
data-id=linenumber
data-id=id429
lineNumber
The offending line number from where an exception was thrown in the JavaScript code.
data-id=43381
data-id=extmessage
data-id=id430
extMessage
A message providing additional details about the exception.
data-id=71361
data-id=message
data-id=id431
message
The error message providing details about the exception.
data-id=24685
data-id=id432
data-id=id433
name
The name of the Error object subclass, indicating the type of the Error object instance.
data-id=error-methods
data-id=id434
Error methods
data-id=69913
data-id=tostring
data-id=id435
toString
Gets the error message that provides details about the exception.
Returns
The error message string. (See the message property.)
data-id=43659
data-id=fdf
data-id=id538
FDF
This object corresponds to a PDF-encoded data exchange file. Typically, FDF files contain forms data that is exported from a PDF file. However, FDF files can also be used as general purpose data files and it is for this latter purpose that the FDF object exists.
All security methods and properties are available only during batch, console, and application initialization events. See priv.
data-id=fdf-properties
data-id=id539
FDF properties
data-id=61881
data-id=deleteoption
data-id=id540
deleteOption
Indicates whether the FDF file should be automatically deleted after it is processed. This value may or may not be used, depending on the content of the FDF file and how it is processed. It is used for embedded files beginning in Acrobat 6.0. Allowed values are
- 0: (default) Acrobat will automatically delete the FDF file after processing
- 1: Acrobat will not delete the FDF file after processing (however, a web or email browser may still delete the file).
- 2: Acrobat will prompt the user to determine whether to delete the FDF file after processing (however, a web or email browser may still delete the file).
data-id=83309
data-id=issigned
data-id=id541
isSigned
Returns true if the FDF data file is signed.
Example: See if the fdf is signed.
var fdf = app.openFDF("/C/temp/myDoc.fdf");
console.println( "It is "+ fdf.isSigned + " that this FDF is signed");
fdf.close();
See a more complete example following signatureSign.
data-id=69469
data-id=numembeddedfiles
data-id=id542
numEmbeddedFiles
The number of files embedded in the FDF file. If the FDF object is a valid FDF file, no exceptions will be thrown.
A file may be embedded in an FDF file with the addEmbeddedFile method. Example: Create a new FDF object, embed a PDF doc, save the FDF, open the FDF again, and count the number of embedded files.
var fdf = app.newFDF();
fdf.addEmbeddedFile("/C/myPDFs/myDoc.pdf");
fdf.save("/c/temp/myDocWrapper.fdf");
fdf = app.openFDF("/c/temp/myDocWrapper.fdf");
console.println("The number of embedded files = "
+ fdf.numEmbeddedFiles);
fdf.close();
data-id=fdf-methods
data-id=id543
FDF methods
data-id=59252
data-id=addcontact
data-id=id544
addContact
Adds a contact to the FDF file.
Parameters
oUserEntityUserEntity object that list the contact to be added to the FDF file.Returns
Throws an exception on failure.
Example:
var oEntity={firstName:"Fred", lastName:"Smith", fullName:"Fred Smith"};
var f = app.newFDF();
f.addContact( oEntity );
f.save( "/c/temp/FredCert.fdf" );
data-id=10402
data-id=addembeddedfile
data-id=id545
addEmbeddedFile
Add the specified file to the end of the array of embedded files in the FDF file. Anyone opening the FDF file will be instructed to save the embedded file or files according to nSaveOption. If the embedded file is a PDF file, it is opened and displayed. If the embedded file is an FDF file, the file is opened for processing.
FDF files containing embedded files have been supported beginning with Acrobat 4.05. An example use for embedding PDF files is when these files are hosted on an HTTP server and the user should click to download and save the PDF file, rather than viewing the file in the browser. There is no relationship between these embedded files and files that are associated with forms data that is stored in an FDF file.
Parameters
cDIPathnSaveOption0 and 3, the user is prompted for the location of the save folder if they have not already set this value. For all values of nSaveOption, if the file is a PDF or FDF file, it is automatically opened by Acrobat after it is saved.Returns
Throws an exception if this operation could not be completed, otherwise returns the number of embedded files that are now in the FDF file.
Example: Create a new FDF, embed a PDF doc, then save.
var fdf = app.newFDF();
fdf.addEmbeddedFile("/C/myPDFs/myDoc.pdf");
fdf.save("/c/temp/myDocs.fdf");
data-id=71568
data-id=addrequest
data-id=id546
addRequest
Adds a request to the FDF file. There can be only one request in an FDF file. If the FDF file already contains a request, it is replaced with this new request.
Parameters
cTypecReturnAddressmailto:, http: or https: and be of the form "http://www.example.com/cgi.pl" or "mailto:jdoe@example.com".cNameReturns
Throws an exception if there is an error.
Example:
var f = app.newFDF();
f.addRequest( "CMS", "http://www.example.com/cgi.pl", "Acme Corp" );
f.save( "/c/tmp/request.fdf" );
data-id=49024
data-id=close
data-id=id547
close
Immediately closes the FDF file.
Returns
Throws an exception if there is an error.
See the FDF object save method, which also closes an FDF file.
Example: See example following the addEmbeddedFile method.
data-id=38284
data-id=mail
data-id=id548
Saves the FDF object as a temporary FDF file and mails this file as an attachment to all recipients, with or without user interaction. The temporary file is deleted after it is no longer needed.
See also a pp. mailGetAddrs, app. mailMsg, the Doc methods mailDoc and mailForm, and the Report object method mail.
Note
On Windows, the client computer must have its default mail program configured to be MAPI enabled to use this method.
Parameters
bUItrue (the default), the rest of the parameters are used to seed a compose-new-message window that is displayed to the user. If false, the cTo parameter is required and all others are optional. - (Acrobat 7.0) When this method is executed in a non-privileged context, the bUI parameter is not honored and defaults to true. See priv.cTocCccBcccSubjectcMsgReturns
Throws an exception if there is an error.
Example:
var fdf = app.openFDF( "/c/temp/myDoc.fdf" );
/* This opens the compose new message window */
fdf.mail();
/* This will send out the mail with the attached FDF file to fun1@example.com
and fun2@example.com */
fdf.mail( false, "fun1@example.com", "fun2@example.com", "",
"This is the subject", "This is the body.");
data-id=72930
data-id=save
data-id=id549
save
Save the FDF object as a file. A save will always occur. The file is closed when it is saved and the FDF object no longer contains a valid object reference.
See the close method, which also closes a FDF file.
Parameters
cDIPathcDIPath must be a safe path (see safe) and must have an extension of .fdf.Returns
Throws an exception if there is an error.
Example: Create a new FDF, embed a PDF doc, then save.
var fdf = app.newFDF()
fdf.addEmbeddedFile("/C/myPDFs/myDoc.pdf");
fdf.save("/c/temp/myDocs.fdf");
data-id=98207
data-id=signatureclear
data-id=id550
signatureClear
If the FDF object is signed, clears the signature and returns true if successful. Does nothing if the FDF object is not signed. Does not save the file.
Returns
true on success.
data-id=33751
data-id=signaturesign
data-id=id551
signatureSign
Sign the FDF object with the specified security object. FDF objects can be signed only once. The FDF object is signed in memory and is not automatically saved as a file to disk. Call save to save the FDF object after it is signed. Call signatureClear to clear FDF signatures.
Parameters
oSigSecurityHandler object that is to be used to sign. Security objects normally require initialization before they can be used for signing. Check the documentation for your security handler to see if it is able to sign FDF files. The signFDF property of the SecurityHandler object will indicate whether a particular security object is capable of signing FDF files.oInfoSignatureInfo object containing the writable properties of the signature.nUIoInfo). * 2: Show a more elaborate dialog box that includes editable fields for reason, location, and contact information. The default is 0.cUISignTitlenUI is non-zero.cUISelectMsgnUI is non-zero.Returns
true if the signature was applied successfully, false otherwise.
Example: Open an existing FDF data file and sign.
var eng = security.getHandler( "Adobe.PPKLite" );
eng.login("myPassword","/c/test/Acme.pfx");
var myFDF = app.openFDF( "/c/temp/myData.fdf" );
if( !myFDF.isSigned ) {
myFDF.signatureSign({
oSig: eng,
nUI: 1,
cUISignTitle: "Sign Embedded File FDF",
cUISelectMsg: "Please select a Digital ID to use to "
+ "sign your embedded file FDF."
});
myFDF.save( "/c/temp/myData.fdf" );
};
data-id=81915
data-id=signaturevalidate
data-id=id552
signatureValidate
Validate the signature of an FDF object and return a SignatureInfo object specifying the properties of the signature.
Parameters
oSigSecurityHandler object or a generic object with the following properties: * oSecHdlr: The SecurityHandler object to use to validate this signature. * bAltSecHdlr: A Boolean value. If true, an alternate security handler, selected based on user preference settings, may be used to validate the signature. The default is false, meaning that the security handler returned by the signature’s handlerName property is used to validate the signature. This parameter is not used if oSecHdlr is provided. If oSig is not supplied, the security handler returned by the signature’s handlerName property is used to validate the signature.true, allow the UI to be shown, if necessary, when validating the data file. The UI may be used to select a validation handler, if none is specified.Returns
A SignatureInfo object. The signature status is described in status property.
Example: Open an FDF file, if signed, validate it the signature and return information to the console.
fdf = app.openFDF("/c/temp/myDoc.fdf");
eng = security.getHandler( "Adobe.PPKLite" );
if (fdf.isSigned)
{
var oSigInfo = fdf.signatureValidate({
oSig: eng,
bUI: true
});
console.println("Signature Status: " + oSigInfo.status);
console.println("Description: " + oSigInfo.statusText);
} else {
console.println("FDF not signed");
}
data-id=36795
data-id=field
data-id=id553
Field
This object represents an Acrobat form field (that is, a field created using the Acrobat form tool or the Doc addField method). In the same manner that a form author can modify an existing field’s properties, such as the border color or font, the JavaScript user can use the Field object to perform the same modifications.
Before a field can be accessed, it must be bound to a JavaScript variable through a method provided by the Doc. 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 = this.getField("Total");
This example allows the script to manipulate the form field “Total” by means of the variable f.
Fields can be arranged hierarchically within a document. For example, form fields with names like “FirstName” and “LastName” are called flat names and there is no association between them. By changing the field names, a hierarchy of fields within the document can be created.
For example, “Name.First” and “Name.Last” forms a tree of fields. The period (‘.’) separator in Acrobat forms denotes a hierarchy shift. “Name” in these fields is the parent; “First” and “Last” are the children. Also, the field “Name” is an internal field because it has no visible appearance. “First” and “Last” are terminal fields that appear on the page.
Acrobat form fields that share the same name also share the same value. Terminal fields can have different presentations of that data. For example, they can appear on different pages, be rotated differently, or have a different font or background color, but they have the same value. Therefore, if the value of one presentation of a terminal field is modified, all others with the same name are updated automatically.
Each presentation of a terminal field is referred to as a widget. An individual widget does not have a name but is identified by index (0-based) within its terminal field. The index is determined by the order in which the individual widgets of this field were created (and is unaffected by tab-order).
You can determine the index for a specific widget by using the Fields navigation tab in Acrobat. The index is the number that follows the ‘#’ sign in the field name shown. (In Acrobat 6.0 or later, the widget index is displayed only if the field has more than one widget.) You can double-click an entry in the Fields panel to go to the corresponding widget in the document. Alternatively, if you select a field in the document, the corresponding entry in the Fields panel is highlighted.
Beginning with Acrobat 6.0, getField can be used to retrieve the Field object of one individual widget of a field. This notation consists of appending a “.” (period) followed by the widget index to the field name passed. When this approach is used, the Field object returned by getField encapsulates only one individual widget. You can use the Field objects returned this way anywhere you would use a Field object returned by passing the unaltered field name. However, the set of nodes that are affected may vary, as shown in the following table.
Beginning with Acrobat 8.0, the LiveCycle Reader Extensions Field right is checked for Field objects only if the JavaScript code is executed outside the PDF file (from the JavaScript console, through batch execution, or through JSObject).
rect property and the setFocus method are exceptions that apply to widget # 0. See example below.)The following example changes the rect property of the second radio button (the first would have index 0) of the field “my radio”.
var f = this.getField("my radio.1");
f.rect = [360, 677, 392, 646];
data-id=54526
data-id=field-versus-widget-attributes
data-id=id554
Field versus widget attributes
Some properties of the Field object, such as value, apply to all widgets that are children of that field. Other properties, such as rect, are specific to individual widgets.
The following field properties and methods affect field-level attributes:
calcOrderIndex, charLimit, comb, currentValueIndices,defaultValue,
doNotScroll, doNotSpellCheck, delay, doc, editable, exportValues,
fileSelect, multiline, multipleSelection, name, numItems,page, password,
readonly, required,submitName, type, userName, value, valueAsString,
clearItems, browseForFileToSubmit, deleteItemAt, getItemAt, insertItemAt,
setAction, setItems,signatureInfo, signatureSign, and signatureValidate.
The following field properties and methods affect widget-level attributes:
alignment, borderStyle, buttonAlignX, buttonAlignY, buttonPosition,
buttonScaleHow, buttonScaleWhen, display, fillColor, hidden, highlight,
lineWidth, print, rect, strokeColor, style, textColor, textFont, textSize,
buttonGetCaption, buttonGetIcon, buttonImportIcon, buttonSetCaption,
buttonSetIcon, checkThisBox, defaultIsChecked, isBoxChecked,
isDefaultChecked, setAction, and setFocus.
Note
The
setActionmethod can apply at the field or widget level, depending on the event. TheKeystroke,Validate,Calculate, andFormatevents apply to fields. TheMouseUp,MouseDown,MouseEnter,MouseExit,OnFocus, andOnBlurevents apply to widgets.
The checkThisBox, defaultIsChecked, isBoxChecked, and isDefaultChecked methods take a widget index, nWidget, as a parameter. If you invoke these methods on a Field object f that represents one specific widget, the nWidget parameter is optional (and is ignored if passed) and the method acts on the specific widget encapsulated by f.
data-id=field-properties
data-id=id555
Field properties
In general, field properties correspond to those stored in field and annotation dictionaries in the PDF document (see the PDF Reference).
Some property values are stored in the PDF document as names, while others are stored as strings (see the PDF Reference). For a property that is stored as a name, there is a 127-character limit on the length of the string.
Examples of properties that have a 127-character limit include value and defaultValue for check boxes and radio buttons. The PDF Reference documents all Annotation properties as well as how they are stored.
data-id=47052
data-id=id559
data-id=id560
alignment
Controls how the text is laid out within the text field. Values are
left
center
right
Fields
text
Example:
var f = this.getField("MyText");
f.alignment = "center";
data-id=18616
borderStyle
The border style for a field. Valid border styles are
solid
dashed
beveled
inset
underline
The border style determines how the border for the rectangle is drawn. The border object is a static convenience constant that defines all the border styles of a field, as shown in the following table:
solidborder.sbeveledborder.bsolid style with an additional beveled (pushed-out appearance) border applied inside the solid border.dashedborder.dinsetborder.isolid style with an additional inset (pushed-in appearance) border applied inside the solid border.underlineborder.uFields
All
Example: The following example shows how to set the border style of a field to solid :
var f = this.getField("MyField");
f.borderStyle = border.s; /* border.s evaluates to "solid" */
data-id=40106
data-id=buttonalignx
data-id=id561
buttonAlignX
Controls how space is distributed from the left of the button face with respect to the icon. It is expressed as a percentage between 0 and 100, inclusive. The default value is 50.
If the icon is scaled anamorphically (which results in no space differences), this property is not used.
Fields
button
data-id=41863
data-id=buttonaligny
data-id=id562
buttonAlignY
Controls how unused space is distributed from the bottom of the button face with respect to the icon. It is expressed as a percentage between 0 and 100, inclusive. The default value is 50.
If the icon is scaled anamorphically (which results in no space differences), this property is not used.
Fields
button
Example: This example is an elevator animation. The field “myElevator” is a button form field that has small width and large height. An icon is imported as the appearance face.
function MoveIt()
{
if ( f.buttonAlignY == 0 ) {
f.buttonAlignY++;
run.dir = true;
return;
}
if ( f.buttonAlignY == 100 ) {
f.buttonAlignY--;
run.dir = false;
return;
}
if (run.dir) f.buttonAlignY++;
else f.buttonAlignY--;
}
var f = this.getField("myElevator");
f.buttonAlignY=0;
run = app.setInterval("MoveIt()", 100);
run.dir=true;
toprun = app.setTimeOut(
"app.clearInterval(run); app.clearTimeOut(toprun)", 2*20000+100);
data-id=13558
data-id=buttonfitbounds
data-id=id563
buttonFitBounds
If true, the extent to which the icon may be scaled is set to the bounds of the button field. The additional icon placement properties are still used to scale and position the icon within the button face.
In previous versions of Acrobat, the width of the field border was always taken into consideration when scaling an icon to fit a button face, even when no border color was specified. Setting this property to true when a border color has been specified for the button will cause an exception to be raised.
Fields
button
data-id=23056
data-id=buttonposition
data-id=id564
buttonPosition
Controls how the text and the icon of the button are positioned with respect to each other within the button face. The convenience position object defines all of the valid alternatives.
position.textOnlyposition.iconOnlyposition.iconTextVposition.textIconVposition.iconTextHposition.textIconHposition.overlayFields
button
data-id=36156
data-id=buttonscalehow
data-id=id565
buttonScaleHow
Controls how the icon is scaled (if necessary) to fit inside the button face. The convenience scaleHow object defines all of the valid alternatives:
scaleHow.proportionalscaleHow.anamorphicFields
button
data-id=36367
data-id=buttonscalewhen
data-id=id566
buttonScaleWhen
Controls when an icon is scaled to fit inside the button face. The convenience scaleWhen object defines all of the valid alternatives:
scaleWhen.alwaysscaleWhen.neverscaleWhen.tooBigscaleWhen.tooSmallFields
button
data-id=20477
data-id=calcorderindex
data-id=id567
calcOrderIndex
Changes the calculation order of fields in the document. When a computable text or combo box field is added to a document, the field’s name is appended to the calculation order array. The calculation order array determines in what order the fields are calculated. The calcOrderIndex property works similarly to the Calculate tab used by the Acrobat Form tool.
Fields
combobox, text
Example:
var a = this.getField("newItem");
var b = this.getField("oldItem");
a.calcOrderIndex = b.calcOrderIndex + 1;
In this example, the “newItem” field was added after the “oldItem” field. The script changes the calcOrderIndex property of the “newItem” field so that it is calculated before the “oldItem” field.
data-id=42060
data-id=charlimit
data-id=id568
charLimit
Limits the number of characters that a user can type into a text field.
See event. fieldFull to detect when the maximum number of characters is reached.
Fields
text
Example: Set a limit on the number of characters that can be typed into a field.
var f = this.getField("myText");
f.charLimit = 20;
data-id=64322
data-id=comb
data-id=id569
comb
If set to true, the field background is drawn as series of boxes (one for each character in the value of the field) and each character of the content is drawn within those boxes. The number of boxes drawn is determined from the charLimit property.
It applies only to text fields. The setter will also raise if any of the following field properties are also set multiline, password, and fileSelect. A side-effect of setting this property is that the doNotScroll property is also set.
Fields
text
Example: Create a comb field in the upper left corner of a newly created document.
var myDoc = app.newDoc(); // Create a blank doc
var Bbox = myDoc.getPageBox("Crop"); // Get crop box
var inch = 72;
// Add a text field at the top of the document
var f = myDoc.addField("Name.Last", "text", 0,
[ inch, Bbox[1]-inch, 3*inch, Bbox[1]- inch - 14 ] );
// Add some attributes to this text field
f.strokeColor = color.black;
f.textColor = color.blue;
f.fillColor = ["RGB",1,0.66,0.75];
f.comb = true; // Declare this is a comb field
f.charLimit = 10; // Max number of characters
data-id=74343
data-id=commitonselchange
data-id=id570
commitOnSelChange
Controls whether a field value is committed after a selection change:
- If
true, the field value is committed immediately when the selection is made. - If
false, the user can change the selection multiple times without committing the field value. The value is committed only when the field loses focus, that is, when the user clicks outside the field.
Fields
combobox, listbox
data-id=52225
data-id=currentvalueindices
data-id=id571
currentValueIndices
Reads and writes single or multiple values of a list box or combo box.
Read
Returns the options-array indices of the strings that are the value of a list box or combo box field. These indices are 0-based. If the value of the field is a single string, it returns an integer. Otherwise, it returns an array of integers sorted in ascending order. If the current value of the field is not a member of the set of offered choices (as could happen in the case of an editable combo box) it returns -1.
Write
Sets the value of a list box or combo box. It accepts a single integer or array of integers as an argument. To set a single string as the value, pass an integer that is the 0-based index of that string in the options array. Note that in the case of an editable combo box, if the desired value is not a member of the set of offered choices, you must set the value instead. Except for this case, currentValueIndices is the preferred way to set the value of a list box or combo box.
To set a multiple selection for a list box that allows it, pass an array as argument to this property, containing the indices (sorted in ascending order) of those strings in the options array. If passed an array like this: Field.value=["item1", "item3"], it also selects the items. The ability for a list box to support multiple selections can be set through multipleSelection.
Related methods and properties include numItems, getItemAt, insertItemAt, deleteItemAt and setItems.
Fields
combobox, listbox
Example (Read)
A mouse-up action of a button. The script gets the current value of a list box.
var f = this.getField("myList");
var a = f.currentValueIndices;
if (typeof a == "number") // A single selection
console.println("Selection: " + f.getItemAt(a, false));
else { // Multiple selections
console.println("Selection:");
for (var i = 0; i < a.length; i ++)
console.println(" " + f.getItemAt(a[i], false));
}
Example (Write)
The following code, selects the second and fourth (0-based index values, 1 and 3, respectively) in a list box.
var f = this.getField("myList");
f.currentValueIndices = [1,3];
data-id=14483
data-id=defaultstyle
data-id=id572
defaultStyle
Span objectThis property defines the default style attributes for the form field. If the user clicks an empty field and begins entering text without changing properties using the property toolbar, these are the properties that will be used. This property is a single Span object without a text property. Some of the properties in the default style span mirror the properties of the Field object. Changing these properties also modifies the defaultStyle property for the field and vice versa.
The following table details the properties of the Field object that are also in the default style and any differences between their values.
alignmentalignmentalignment property has the same values for both the default style and the Field object.textFontfontFamily fontStyle fontWeighttextColortextColortextColor property has the same values for both the default style and the Field object.textSizetextSizetextSize property has the same values for both the default style and the Field object.Note
When a field is empty,
defaultStyleis the style used for newly entered text. If a field already contains text whendefaultStyleis changed, the text will not pick up any changes todefaultStyle. Newly entered text uses the attributes of the text it is inserted into (or specified with the toolbar).
When pasting rich text into a field, unspecified attributes in the pasted rich text are filled with those from defaultStyle.
Superscript and Subscript are ignored in defaultStyle.
Fields
rich text
Example: Change the default style for a text field.
var style = this.getField("Text1").defaultStyle;
style.textColor = color.red;
style.textSize = 18;
// if Courier Std is not found, use a monospace font
style.fontFamily = ["Courier Std", "monospace" ];
this.getField("Text1").defaultStyle = style;
data-id=36634
data-id=defaultvalue
data-id=id573
defaultValue
The default value of a field—that is, the value that the field is set to when the form is reset. For combo boxes and list boxes, either an export or a user value can be used to set the default. A conflict can occur, for example, when the field has an export value and a user value with the same value but these apply to different items in the list. In such cases, the export value is matched against first.
Fields
all except button, signature
Example:
var f = this.getField("Name");
f.defaultValue = "Enter your name here.";
data-id=30113
data-id=donotscroll
data-id=id574
doNotScroll
If true, the text field does not scroll and the user, therefore, is limited by the rectangular region designed for the field. Setting this property to true or false corresponds to checking or unchecking the Scroll Long Text field in the Options tab of the field.
Fields
text
data-id=73181
data-id=donotspellcheck
data-id=id575
doNotSpellCheck
If true, spell checking is not performed on this editable text field. Setting this property to true or false corresponds to unchecking or checking the Check Spelling attribute in the Options tab of the Field Properties dialog box.
Fields
combobox (editable), text
data-id=29401
data-id=id576
data-id=id577
delay
Delays the redrawing of a field’s appearance. It is generally used to buffer a series of changes to the properties of the field before requesting that the field regenerate its appearance. Setting the property to true forces the field to wait until delay is set to false. The update of its appearance then takes place, redrawing the field with its latest settings.
There is a corresponding Doc delay flag if changes are being made to many fields at once.
Fields
all
Example: Change the appearance of a check box. Set delay to true, makes changes, and sets delay to false.
// Get the myCheckBox field
var f = this.getField("myCheckBox");
// Set the delay and change the fields properties
// to beveled edge and medium thickness line.
f.delay = true;
f.borderStyle = border.b;
.
.. // A number of other changes
f.strokeWidth = 2;
f.delay = false; // Force the changes now
data-id=10117
data-id=display
data-id=id578
display
Controls whether the field is hidden or visible on screen and in print. The values for the display property are listed in the table below.
display.visibledisplay.hiddendisplay.noPrintdisplay.noViewThis property supersedes the older hidden and print properties.
Fields
all
Example:
// Set the display property
var f = getField("myField");
f.display = display.noPrint;
// Test whether field is hidden on screen and in print
if (f.display == display.hidden) console.println("hidden");
data-id=15139
data-id=id579
data-id=id580
doc
Returns the Doc of the document to which the field belongs.
Fields
all
data-id=36583
data-id=editable
data-id=id581
editable
Controls whether a combo box is editable. If true, the user can type in a selection. If false, the user must choose one of the provided selections.
Fields
combobox
Example:
var f = this.getField("myComboBox");
f.editable = true;
data-id=58250
data-id=exportvalues
data-id=id582
exportValues
An array of strings representing the export values for the field. The array has as many elements as there are annotations in the field. The elements are mapped to the annotations in the order of creation (unaffected by tab-order).
For radio button fields, this property is required to make the field work properly as a group. The button that is checked at any time gives its value to the field as a whole.
For check box fields, unless an export value is specified, “Yes” (or the corresponding localized string) is the default when the field is checked. “Off” is the default when the field is unchecked (the same as for a radio button field when none of its buttons are checked).
Fields
checkbox, radiobutton
Example: Create a radio button field and sets its export values.
var d = 40;
var f = this.addField("myRadio","radiobutton",0, [200, 510, 210, 500]);
this.addField("myRadio","radiobutton",0, [200+d, 510-d, 210+d, 500-d]);
this.addField("myRadio","radiobutton",0, [200, 510-2*d, 210, 500-2*d]);
this.addField("myRadio","radiobutton",0, [200-d, 510-d, 210-d, 500-d]);
f.strokeColor = color.black;
// Now give each radio field an export value
f.exportValues = ["North", "East", "South", "West"];
data-id=69226
data-id=fileselect
data-id=id583
fileSelect
If true, sets the file-select flag in the Options tab of the text field (Field is Used for File Selection). This indicates that the value of the field represents a path of a file whose contents may be submitted with the form.
The path may be entered directly into the field by the user, or the user can browse for the file. (See the browseForFileToSubmit method.)
Note
The file select flag is mutually exclusive with the
multiline,charLimit,password, anddefaultValueproperties. Also, on the Mac OS platform, when setting the file select flag, the field gets treated as read-only. Therefore, the user must browse for the file to enter into the field. (See browseForFileToSubmit.)
This property can only be set during a batch or console event. See priv. The event object contains a discussion of JavaScript events.
Fields
text
data-id=16464
data-id=id584
data-id=id585
fillColor
Specifies the background color for a field. The background color is used to fill the rectangle of the field. Values are defined by using transparent, gray, RGB or CMYK color. See Color arrays for information on defining color arrays and how values are used with this property.
In older versions of this specification, this property was named bgColor. The use of bgColor is now discouraged, although it is still valid for backward compatibility.
Fields
all
Example: Change the background color of a text field. If the current color is red, it changes to blue, otherwise it changes to yellow.
var f = this.getField("myField");
if (color.equal(f.fillColor, color.red))
f.fillColor = color.blue;
else
f.fillColor = color.yellow;
data-id=29686
data-id=id586
data-id=id587
hidden
Note
This property has been superseded by the
displayproperty and its use is discouraged.
If the value is false, the field is visible to the user; if true, the field is invisible. The default value is false.
Fields
all
data-id=12328
data-id=highlight
data-id=id588
highlight
Defines how a button reacts when a user clicks it. The four highlight modes supported are:
- none: No visual indication that the button has been clicked.
- invert: The region encompassing the button’s rectangle inverts momentarily.
- push: The down face for the button (if any) is displayed momentarily.
- outline: The border of the rectangleinverts momentarily.
- The convenience
highlightobject defines each state, as follows:
nonehighlight.ninverthighlight.ipushhighlight.poutlinehighlight.oFields
button
Example: Set the highlight property of a button to “invert”.
var f = this.getField("myButton");
f.highlight = highlight.i;
data-id=98518
lineWidth
Specifies the thickness of the border when stroking the perimeter of a field’s rectangle. If the stroke color is transparent, this parameter has no effect except in the case of a beveled border. Values are:
- 0: none
- 1: thin
- 2: medium
- 3: thick
In older versions of this specification, this property was borderWidth. The use of borderWidth is now discouraged, although it is still valid for backward compatibility.
The default value for lineWidth is 1 (thin). Any integer value can be used; however, values beyond 5 may distort the field’s appearance.
Fields
all
Example: Change the border width of the Text Box to medium thickness
f.lineWidth = 2
data-id=79716
data-id=multiline
data-id=id589
multiline
Controls how text is wrapped within the field. If false (the default), the text field can be a single line only. If true, multiple lines are allowed and they wrap to field boundaries.
Fields
text
Example: See the Doc getField method.
data-id=72810
data-id=multipleselection
data-id=id590
multipleSelection
If true, indicates that a list box allows a multiple selection of items.
See also type, value, and currentValueIndices.
Fields
listbox
data-id=13887
data-id=id591
data-id=id592
name
This property returns the fully qualified field name of the field as a string object.
Beginning with Acrobat 6.0, if the Field object represents one individual widget, the returned name includes an appended ‘.’ followed by the widget index.
Fields
all
Example: Get a Field object and write the name of the field to the console.
var f = this.getField("myField");
// Displays "myField" in the console window
console.println(f.name);
data-id=16920
data-id=numitems
data-id=id593
numItems
The number of items in a combo box or list box.
Fields
combobox, listbox
Example: Get the number of items in a list box.
var f = this.getField("myList");
console.println("There are " + f.numItems + " in this list box");
Face names and values of a combo box or list box can be accessed through the getItemAt method. See that method for an additional example of numItems.
data-id=40237
data-id=id594
data-id=id595
page
The page number or an array of page numbers of a field. If the field has only one appearance in the document, the page property returns an integer representing the 0-based page number of the page on which the field appears. If the field has multiple appearances, it returns an array of integers, each member of which is a 0-based page number of an appearance of the field. The order in which the page numbers appear in the array is determined by the order in which the individual widgets of this field were created (and is unaffected by tab-order). If an appearance of the field is on a hidden template page, page returns a value of -1 for that appearance.
Fields
all
Example 1: Determine whether a particular field appears on one page, or more than one page.
var f = this.getField("myField");
if (typeof f.page == "number")
console.println("This field only occurs once on page " + f.page);
else
console.println("This field occurs " + f.page.length + " times);
Example 2 (Acrobat 6.0)
The page property can be used to get the number of widgets associated with a field name. This example gets the number of radio buttons in a radio button field.
var f = this.getField("myRadio");
if ( typeof f.page == "object" )
console.println("There are " + f.page.length
+ " radios in this field.");
data-id=16278
data-id=password
data-id=id596
password
Specifies whether the field should display asterisks when data is entered in the field. (Upon submission, the actual data entered is sent.) If this property is true, data in the field is not saved when the document is saved to disk.
Fields
text
data-id=38471
data-id=id597
data-id=id598
Note
This property has been superseded by the
displayproperty and its use is discouraged.
If true, the field appears when the user prints the document. If false, the field does not appear when printing. This property can be used to hide control buttons and other fields that are not useful on the printed page.
Fields
all
data-id=54850
data-id=radiosinunison
data-id=id599
radiosInUnison
If false, even if a group of radio buttons have the same name and export value, they behave in a mutually exclusive fashion, like HTML radio buttons. The default for new radio buttons is false.
If true, if a group of radio buttons have the same name and export value, they turn on and off in unison, as in Acrobat 4.0.
Fields
radiobutton
data-id=27391
data-id=id600
data-id=id601
readonly
The read-only characteristic of a field. If a field is read-only, the user can see the field but cannot change it.
Fields
all
Example: Get a field and make it read-only.
var f = this.getField("myTextField");
f.value = "You can't change this message!";
f.readonly = true;
data-id=91364
data-id=id602
data-id=id603
rect
An array of four numbers in rotated user space that specify the size and placement of the form field. These four numbers are the coordinates of the bounding rectangle and are listed in the following order: upper-left x, upper-left y, lower-right x and lower-right y.
Note
The
Annotationobject also has arectproperty. However, the coordinates are not in rotated user space and they are in a different order than in the Field objectrectproperty.
Fields
all
Example 1: Lay out a 2-inch-wide text field just to the right of the field “myText”.
var f = this.getField("myText"); // Get the Field object
var myRect = f.rect; // and get its rectangle
myRect[0] = f.rect[2]; // The ulx for new = lrx for old
myRect[2] += 2 * 72; // Move two inches for lry
f = this.addField("myNextText", "text", this.pageNum, myRect);
f.strokeColor = color.black;
Example 2: Move an existing button field 10 points to the right.
var b = this.getField("myButton");
var aRect = b.rect; // Make a copy of b.rect
aRect[0] += 10; // Increment first x coordinate by 10
aRect[2] += 10; // Increment second x coordinate by 10
b.rect = aRect; // Update the value of b.rect
data-id=28273
data-id=required
data-id=id604
required
Specifies whether a field requires a value. If true, the field’s value must be non-null when the user clicks a submit button that causes the value of the field to be posted. If the field value is null, the user receives a warning message and the submit does not occur.
Fields
all except button
Example: Make “myField” into a required field.
var f = this.getField("myField");
f.required = true;
data-id=87647
data-id=richtext
data-id=id605
richText
If true, the field allows rich text formatting. The default is false.
Fields
text
Related objects and properties are richValue, defaultStyle, event. richValue, event. richChange, event. richChangeEx, the Annotation object richContents property, and the Span object.
Example 1: Get a Field object and set it for rich text formatting.
var f = this.getField("Text1");
f.richText = true;
See richValue for a more complete example.
data-id=55711
Example 2: Count the number of rich text fields in the document.
var count = 0;
for ( var i = 0; i < this.numFields; i++)
{
var fname = this.getNthFieldName(i);
var f = this.getField(fname);
if ( f.type == "text" && f.richText ) count++
}
console.println("There are a total of "+ count + " rich text fields.");
data-id=88243
data-id=id606
data-id=id607
richValue
Span objectsThis property specifies the text contents and formatting of a rich text field. For field types other than rich text, this property is undefined. The rich text contents are represented as an array of Span objects containing the text contents and formatting of the field.
Fields
rich text
Related objects and properties are richText, defaultStyle, event. richValue, event. richChange, event. richChangeEx, the Annotation object richContents property, and the Span object.
Example 1: Turn all bold text into red underlined text.
var f = this.getField("Text1");
var spans = f.richValue;
for ( var i = 0; i < spans.length; i++ )
{
if( spans[i].fontWeight >= 700 )
{
spans[i].textColor = color.red;
spans[i].underline = true;
}
}
f.richValue = spans;
data-id=48009
2
Create a text field, marks it for rich text formatting, and inserts rich text.
var myDoc = app.newDoc(); // Create a blank doc
var Bbox = myDoc.getPageBox("Crop"); // Get crop box
var inch = 72;
// Add a text field at the top of the document
var f = myDoc.addField("Text1", "text", 0,
[72, Bbox[1]-inch, Bbox[2]-inch, Bbox[1]-2*inch ] );
// Add some attributes to this text field
f.strokeColor = color.black;
f.richText = true; // Rich text
f.multiline = true; // Multiline
// Now build up an array of Span objects
var spans = new Array();
spans[0] = new Object();
spans[0].text = "Attention:r";
spans[0].textColor = color.blue;
spans[0].textSize = 18;
spans[1] = new Object();
spans[1].text = "Adobe Acrobat 6.0r";
spans[1].textColor = color.red;
spans[1].textSize = 20;
spans[1].alignment = "center";
spans[2] = new Object();
spans[2].text = "will soon be here!";
spans[2].textColor = color.green;
spans[2].fontStyle = "italic";
spans[2].underline = true;
spans[2].alignment = "right";
// Now give the rich field a rich value
f.richValue = spans;
data-id=35949
data-id=rotation
data-id=id608
rotation
The rotation of a widget in counterclockwise increments. Valid values are 0, 90, 180, and 270.
Fields
all
Example: Create a rotated text field on each page and fill it with text.
for ( var i=0; i < this.numPages; i++) {
var f = this.addField("myRotatedText"+i,"text",i,[6, 6+72, 18, 6]);
f.rotation = 90; f.value = "Confidential";
f.textColor = color.red; f.readonly = true;
}
data-id=20562
data-id=id609
data-id=id610
strokeColor
Specifies the stroke color for a field that is used to stroke the rectangle of the field with a line as large as the line width. Values are defined by using transparent, gray, RGB or CMYK color. See Color arrays 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 discouraged, although it is still valid for backward compatibility.
Fields
all
Example: Change the stroke color of each text field in the document to red.
for ( var i=0; i < this.numFields; i++) {
var fname = this.getNthFieldName(i);
var f = this.getField(fname);
if ( f.type == "text" ) f.strokeColor = color.red;
}
data-id=51110
data-id=id611
data-id=id612
style
Allows the user to set the glyph style of a check box or radio button. The glyph style is the graphic used to indicate that the item has been selected.
The style values are associated with keywords as follows.
style.chstyle.crstyle.distyle.cistyle.ststyle.sqFields
checkbox, radiobutton
Example: This example sets the glyph style to circle.
var f = this.getField("myCheckbox");
f.style = style.ci;
data-id=19265
data-id=submitname
data-id=id613
submitName
If nonempty, used during form submission instead of name. Only applicable if submitting in HTML format (that is, URL-encoded).
Fields
all
data-id=74886
data-id=textcolor
data-id=id614
textColor
The foreground color of a field. It represents the text color for text, button, or list box fields and the check color for check box or radio button fields. Values are defined the same as the fillColor. See Color arrays for information on defining color arrays and how values are set and used with this property.
In older versions of this specification, this property was fgColor. The use of fgColor is now discouraged, although it is still valid for backward compatibility.
Note
An exception is thrown if a transparent color space is used to set
textColor.
Fields
all
Example: This example sets the foreground color to red.
var f = this.getField("myField");
f.textColor = color.red;
data-id=11104
data-id=id615
data-id=id616
textFont
The font that is used when laying out text in a text field, combo box, list box or button. Valid fonts are defined as properties of the font object. Beginning with Acrobat 5.0, arbitrary fonts can also be used. See fonts.
Fields
button, combobox, listbox, text
data-id=45386
font Object
font.Timesfont.TimesBfont.TimesIfont.TimesBIfont.Helvfont.HelvBfont.HelvIfont.HelvBIfont.Courfont.CourBfont.CourIfont.CourBIfont.Symbolfont.ZapfDdata-id=34606
Use of arbitrary fonts
Beginning with Acrobat 5.0, an arbitrary font can be used when laying out a text field, combo box, list box or button by setting the value of textFont to the PDSysFont font name, as returned by PDSysFontGetName. (See the Acrobat and PDF Library API Reference.)
- To find the PDSysFont font name of a font:
- Create a text field in a PDF document. Using the UI, set the text font for this field to the desired font.
- Open the JavaScript Debugger Console and execute the script
this.getField("Text1").textFont
The above code assumes the name of the field is Text1.
- The string returned to the console is the font name needed to programmatically set the text font.
Example: Set the font to Helvetica.
var f = this.getField("myField");
f.textFont = font.Helv;
Example (Acrobat 5.0)
Set the font of myField to Viva-Regular.
var f = this.getField("myField");
f.textFont = "Viva-Regular";
data-id=35479
data-id=id617
data-id=id618
textSize
Specifies the text size (in points) to be used in all controls. In check box and radio button fields, the text size determines the size of the check. Valid text sizes range from 0 to 32767, inclusive. A value of zero means the largest point size that allows all text data to fit in the field’s rectangle.
Fields
all
Example: Set the text size of “myField” to 28 points.
this.getField("myField").textSize = 28;
data-id=27024
data-id=id619
data-id=id620
type
Returns the type of the field as a string. Valid types are:
button
checkbox
combobox
listbox
radiobutton
signature
text
Fields
all
Example: Count the number of text fields in the document.
var count = 0;
for ( var i=0; i<this.numFields; i++) {
var fname = this.getNthFieldName(i);
if ( this.getField(fname).type == "text" ) count++; }
console.println("There are " + count + " text fields.");
data-id=38544
data-id=username
data-id=id621
userName
The user name (short description string) of the field. It is intended to be used as tooltip text whenever the cursor enters a field. It can also be used as a user-friendly name, instead of the field name, when generating error messages.
Fields
all
Example: Add a tooltip to a button field.
var f = this.getField("mySubmit");
f.userName = "Press this button to submit your data.";
data-id=22606
data-id=id622
data-id=id623
value
The value of the field data that the user has entered. Depending on the type of the field, may be a String, Date, or Number. Typically, the value is used to create calculated fields.
Beginning with Acrobat 6.0, if a field contains rich text formatting, modifying this property will discard the formatting and regenerate the field value and appearance using the defaultStyle and plain text value. To modify the field value and maintain formatting use the richValue property.
Note
For signature fields, if the field has been signed, a non-
nullstring is returned as the value.
For Acrobat 5.0 or later, if the field is a list box that accepts multiple selections (see multipleSelection), you can pass an array to set the value of the field, and value returns an array for a list box with multiple values currently selected.
The currentValueIndices of a list box that has multiple selections is the preferred and most efficient way to get and set the value of this type of field.
See also valueAsString and event. type.
Fields
all except button
Example: In this example, the value of the field being calculated is set to the sum of the “Oil” and “Filter” fields and multiplied by the state sales tax.
var oil = this.getField("Oil");
var filter = this.getField("Filter");
event.value = (oil.value + filter.value) * 1.0825;
data-id=74707
data-id=valueasstring
data-id=id624
valueAsString
Returns the value of a field as a JavaScript string.
It differs from value, which attempts to convert the contents of a field contents to an accepted format. For example, for a field with a value of “020”, value returns the integer 20, while valueAsString returns the string “020”.
Fields
all except button
data-id=field-methods
data-id=id625
Field methods
data-id=60961
data-id=browseforfiletosubmit
data-id=id626
browseForFileToSubmit
If invoked on a text field for which the fileSelect flag is set (checked), opens a standard file-selection dialog box. The path entered through the dialog box is automatically assigned as the value of the text field.
If invoked on a text field in which the fileSelect flag is clear (unchecked), an exception is thrown.
Example: The following code references a text field with the file select flag checked. It is a mouse-up action of a button field.
var f = this.getField("resumeField");
f.browseForFileToSubmit();
data-id=21910
data-id=buttongetcaption
data-id=id627
buttonGetCaption
Gets the caption associated with a button.
Use buttonSetCaption to set the caption.
Parameters
nFaceReturns
The caption string associated with the button.
Example: This example places pointing arrows to the left and right of the caption on a button field with icon and text.
// A mouse enter event
event.target.buttonSetCaption("=> "+ event.target.buttonGetCaption()
+" <=");
// A mouse exit event
var str = event.target.buttonGetCaption();
str = str.replace(/=> <=/g, "");
event.target.buttonSetCaption(str);
The same effect can be created by having the same icon for rollover and the same text, with the arrows inserted, for the rollover caption. This approach would be slower and cause the icon to flicker. The above code gives a very fast and smooth rollover effect because only the caption is changed, not the icon.
data-id=41330
data-id=buttongeticon
data-id=id628
buttonGetIcon
Gets the Icon object of a specified type associated with a button.
See also the buttonSetIcon method for assigning an icon to a button.
Parameters
nFaceReturns
The Icon object.
Example:
// Swap two button icons.
var f = this.getField("Button1");
var g = this.getField("Button2");
var temp = f.buttonGetIcon();
f.buttonSetIcon(g.buttonGetIcon());
g.buttonSetIcon(temp);
See also buttonSetIcon and buttonImportIcon.
data-id=27194
data-id=buttonimporticon
data-id=id629
buttonImportIcon
Imports the appearance of a button from another PDF file. If neither optional parameter is passed, the user is prompted to select a file.
See also buttonGetIcon, buttonSetIcon, addIcon, getIcon, importIcon, and removeIcon.
Note
(Acrobat 8.0) If
cPathis specified, this method can only be executed during batch and console events. See priv. The event object contains a discussion of JavaScript events.
Parameters
cPathcPath as a PDF file. On failure, Acrobat tries to convert the file to PDF from one of the known graphics formats (BMP, GIF, JPEG, PCX, PNG, TIFF) and then import the converted file as a button icon.nPageReturns
An integer, as follows:
- 1: The user cancelled the dialog
- 0: No error
- -1: The selected file could not be opened
- -2: The selected page was invalid
Example (Acrobat 5.0)
It is assumed that we are connected to an employee information database. We communicate with the database using the ADBC object and related objects. An employee’s record is requested and three columns are utilized, FirstName, SecondName, and Picture. The Picture column, from the database, contains a device-independent path to the employee’s picture, stored in PDF format. The script might look like this:
var f = this.getField("myPicture");
f.buttonSetCaption(row.FirstName.value + " " + row.LastName.value);
if (f.buttonImportIcon(row.Picture.value) != 0)
f.buttonImportIcon("/F/employee/pdfs/NoPicture.pdf");
The button field “myPicture” has been set to display both icon and caption. The employee’s first and last names are concatenated to form the caption for the picture. Note that if there is an error in retrieving the icon, a substitute icon can be imported.
data-id=22265
data-id=buttonsetcaption
data-id=id630
buttonSetCaption
Sets the caption associated with a button.
Use buttonGetCaption to get the current caption.
See buttonAlignX, buttonAlignY, buttonFitBounds, buttonPosition, buttonScaleHow, and buttonScaleWhen for details on how the icon and caption are placed on the button face.
Parameters
cCaptionnFaceExample:
var f = this.getField("myButton");
f.buttonSetCaption("Hello");
data-id=39147
data-id=buttonseticon
data-id=id631
buttonSetIcon
Sets the icon associated with a button.
See buttonAlignX, buttonAlignY, buttonFitBounds, buttonPosition, buttonScaleHow, and buttonScaleWhen for details on how the icon and caption are placed on the button face.
Use either buttonGetIcon or doc.getIcon to get an Icon object that can be used for the oIcon parameter of this method.
Note
This method must be executed from script embedded within the document. Executing script containing
buttonSetIconin the console of the Adobe Reader, for example, will throw aNotAllowedErrorexception.
Parameters
oIconIcon object associated with the button.nFaceExample: This example takes every named icon in the document and creates a list box using the names. Selecting an item in the list box sets the icon with that name as the button face of the field “myPictures”. What follows is the mouse-up action of the button field “myButton”.
var f = this.getField("myButton")
var aRect = f.rect;
aRect[0] = f.rect[2]; // Place list box relative to the
aRect[2] = f.rect[2] + 144; // position of "myButton"
var myIcons = new Array();
var l = addField("myIconList", "combobox", 0, aRect);
l.textSize = 14;
l.strokeColor = color.black;
for (var i = 0; i < this.icons.length; i++)
myIcons[i] = this.icons[i].name;
l.setItems(myIcons);
l.setAction("Keystroke",
'if (!event.willCommit) {rt'
+ 'var f = this.getField("myPictures");rt'
+ 'var i = this.getIcon(event.change);rt'
+ 'f.buttonSetIcon(i);r'
+ '}');
The named icons themselves can be imported into the document through an interactive scheme, such as the example given in addIcon or through a batch sequence.
See also buttonGetCaption for a more extensive example.
data-id=20167
data-id=checkthisbox
data-id=id632
checkThisBox
Checks or unchecks the specified widget.
Only check boxes can be unchecked. A radio button cannot be unchecked using this method, but if its default state is unchecked (see defaultIsChecked) it can be reset to the unchecked state using the resetForm. method of the Doc.
Note
For a set of radio buttons that do not have duplicate export values, you can set the
valueto the export value of the individual widget that should be checked (or pass an empty string if none should be).
Parameters
nWidgetbCheckIttrue.Example: Check a check box.
var f = this.getField("ChkBox");
f.checkThisBox(0,true);
data-id=34371
data-id=clearitems
data-id=id633
clearItems
Clears all the values in a list box or combo box.
Related methods and properties include numItems, getItemAt, deleteItemAt, currentValueIndices, insertItemAt and setItems.
Example: Clear the field “myList” of all items.
this.getField("myList").clearItems();
data-id=29663
data-id=defaultischecked
data-id=id634
defaultIsChecked
Sets the specified widget to be checked or unchecked by default.
Note
For a set of radio buttons that do not have duplicate export values, you can set the
defaultValueto the export value of the individual widget that should be checked by default (or pass an empty string if none should be checked).
Parameters
nWidgetbIsDefaultCheckedtrue (the default), the widget should be checked by default (for example, when the field gets reset). If false, it should be unchecked by default.Returns
true on success.
Example: Change the default of “ChkBox” to checked, then reset the field to reflect the default value.
var f = this.getField("ChkBox");
f.defaultIsChecked(0,true);
this.resetForm(["ChkBox"]);
data-id=22922
data-id=deleteitemat
data-id=id635
deleteItemAt
Deletes an item in a combo box or a list box.
For a list box, if the current selection is deleted, the field no longer has a current selection. If this method is invoked again on the same field and no parameter is specified, unexpected behavior can result because there is no current selection to delete. Therefore, it is important to make a new selection (such as by using the currentValueIndices method) for the method to behave as documented.
Parameters
nIdxExample: Delete the current item in the list, then select the top item in the list.
var a = this.getField("MyListBox");
a.deleteItemAt(); // Delete current item, and...
a.currentValueIndices = 0; // select top item in list
data-id=20956
data-id=getarray
data-id=id636
getArray
Gets the array of terminal child fields (that is, fields that can have a value) for this Field object, the parent field.
Returns
An array of Field objects
Example: Make a calculation of the values of the child fields of the parent field.
// f has 3 children: f.v1, f.v2, f.v3
var f = this.getField("f");
var a = f.getArray();
var v = 0.0;
for (j =0; j < a.length; j++) v += a[j].value;
// v contains the sum of all the children of field "f"
data-id=14076
data-id=getitemat
data-id=id637
getItemAt
Gets the internal value of an item in a combo box or a list box.
The number of items in a list can be obtained from numItems. See also insertItemAt, deleteItemAt, clearItems, currentValueIndices and setItems.
Parameters
nIdxbExportValuetrue (the default), if the item has an export value, it is returned. If there is no export value, the item name is returned. - If false, the method returns the item name.Returns
The export value or name of the specified item.
Example: In the two examples that follow, assume there are three items on “myList”: “First”, with an export value of 1; “Second”, with an export value of 2; and “Third”, with no export value.
// Returns value of first item in list, which is 1
var f = this.getField("myList");
var v = f.getItemAt(0);
The following example shows the use of the second optional parameter. By setting it to false, the item name (face value) can be obtained, even if there is an export value.
for (var i=0; i < f.numItems; i++)
console.println(f.getItemAt(i,true) + ": " + f.getItemAt(i,false));
The output to the console reads:
1: First
2: Second
Third: Third
data-id=28478
data-id=getlock
data-id=id638
getLock
Gets a Lock object, a generic object that contains the lock properties of a signature field.
See also setLock.
Returns
The Lock object for the field.
data-id=48393
data-id=insertitemat
data-id=id639
insertItemAt
Inserts a new item into a combo box or a list box.
Related methods and properties include numItems, getItemAt, deleteItemAt, clearItems, currentValueIndices and setItems.
Parameters
cNamecExportcName is used as the export value.nIdxExample:
var l = this.getField("myList");
l.insertItemAt("sam", "s", 0); /* inserts sam to top of list l */
data-id=49604
data-id=isboxchecked
data-id=id640
isBoxChecked
Determines whether the specified widget is checked.
Note
For a set of radio buttons that do not have duplicate export values, you can get the
value, which is equal to the export value of the individual widget that is currently checked (or returns an empty string, if none is).
Parameters
nWidgetReturns
true if the specified widget is currently checked, false otherwise.
Example: Determine the state of the check box and report back with an alert box.
var f = this.getField("ChkBox");
var cbStatus = (f.isBoxChecked(0)) ? " " : " not ";
app.alert("The box is" + cbStatus + "checked");
data-id=74380
data-id=isdefaultchecked
data-id=id641
isDefaultChecked
Determines whether the specified widget is checked by default (for example, when the field gets reset).
Note
For a set of radio buttons that do not have duplicate export values, you can get the
defaultValue, which is equal to the export value of the individual widget that is checked by default (or returns an empty string, if none is).
Parameters
nWidgetReturns
true if the specified widget is checked by default, false otherwise.
Example: Determine if the specified check box is checked by default.
var f = this.getField("ChkBox");
var cbStatus = (f.isDefaultChecked(0)) ? "Checked" : "Unchecked";
app.alert("The Default: " + cbStatus);
data-id=37472
data-id=id642
data-id=id643
setAction
Sets the JavaScript action of the field for a given trigger.
Related methods are the Bookmark object setAction method and the Doc methods setAction, addScript, and setPageAction.
Note
This method will overwrite any action already defined for the chosen trigger.
Parameters
cTriggerKeystroke trigger for the Selection Change event.cScriptExample: Set up a button field with addField, add some properties, and a mouse-up action using setAction.
var f = this.addField("actionField", "button", 0, [20, 100, 100, 20]);
f.setAction("MouseUp", "app.beep(0);");
f.delay = true;
f.fillColor = color.ltGray;
f.buttonSetCaption("Beep");
f.borderStyle = border.b;
f.lineWidth = 3;
f.strokeColor = color.red;
f.highlight = highlight.p;
f.delay = false;
data-id=34701
data-id=setfocus
data-id=id644
setFocus
Sets the keyboard focus to this field. This can involve changing the page that the user is currently on or causing the view to scroll to a new position in the document. This method brings the document in which the field resides to the front, if it is not already there.
See also bringToFront.
Example: Search for a certain open document, then focus on the field of interest. This script uses app.activeDocs, which requires the disclosed property of the documents to be true, or the script to be run during console, batch or menu events.
var d = app.activeDocs;
for (var i = 0; i < d.length; i++) {
if (d[i].info.Title == "Response Document") {
d[i].getField("name").value="Enter your name here: "
// also brings the doc to front.
d[i].getField("name").setFocus();
break;
}
}
data-id=90526
data-id=setitems
data-id=id645
setItems
Sets the list of items for a combo box or a list box.
Related methods and properties include numItems, getItemAt, deleteItemAt, currentValueIndices and clearItems.
Parameters
oArrayExamples
Get various fields (combo or list) and set items in the list using various techniques.
var l = this.getField("ListBox");
l.setItems(["One", "Two", "Three"]);
var c = this.getField("StateBox");
c.setItems([["California", "CA"],["Massachusetts", "MA"],
["Arizona", "AZ"]]);
var c = this.getField("NumberBox");
c.setItems(["1", 2, 3, ["PI", Math.PI]]);
data-id=73832
data-id=setlock
data-id=id646
setLock
Controls which fields are to be locked when a signature is applied to this signature field. No modifications can be made to locked fields. If the signature is cleared, all fields that were locked become unlocked. The property settings can be obtained using getLock.
Note
The method can be executed during a batch, application initialization, or console event. See priv.
This method cannot be applied to a field that is in a document that is already signed.
Parameters
oLockLock object containing the lock properties.Returns
true if successful, otherwise false or throws an exception.
data-id=26269
Lock Object
A generic JavaScript object containing lock properties. This object is passed to setLock and returned by getLock for a signature field. It contains the following properties.
actionfieldsInclude or Exclude.data-id=63549
data-id=signaturegetmodifications
data-id=id647
signatureGetModifications
Returns an object containing information on modifications that have been made to the document after the signature field was signed. The information includes only the difference between the current and signed state of the document. Transient objects, such as objects added after the signature but then subsequently deleted, are not reported.
Returns
An object containing modification information. The object has the following properties:
formFieldsCreatedformFieldsDeletedname: type.formFieldsFilledInformFieldsModifiedannotsCreatedAnnotation objectsauthor: name: type.annotsDeletedauthor: name: type.annotsModifiedAnnotation objectsauthor: name: type.numPagesCreatednumPagesDeletednumPagesModifiedspawnedPagesCreatedspawnedPagesDeletedspawnedPagesModifiedExample: Write modification information back to the console.
var sigField = this.getField( "mySignature" );
var sigMods = sigField.signatureGetModifications();
var formFieldsCreated = sigMods.formFieldsCreated;
for( var i = 0; i < formFieldsCreated.length; i++ )
console.println( formFieldsCreated[i].name );
var formFieldsDeleted = sigMods.formFieldsDeleted;
for( var i = 0; i < formFieldsDeleted.length; i++ )
console.println( formFieldsDeleted[i].name );
var formFieldsFilledIn = sigMods.formFieldsFilledIn;
for( var i = 0; i < formFieldsFilledIn.length; i++ )
console.println( formFieldsFilledIn[i].name );
var formFieldsModified = sigMods.formFieldsModified;
for( var i = 0; i < formFieldsModified.length; i++ )
console.println( formFieldsModified[i].name );
var spawnedPages = sigMods.spawnedPagesCreated;
for( var i = 0; i < spawnedPages.length; i++ )
console.println( spawnedPages[i] );
console.println( sigMods.numPagesDeleted );
data-id=10692
data-id=signaturegetseedvalue
data-id=id648
signatureGetSeedValue
Returns a SeedValue object that contains the seed value properties of a signature field. Seed values are used to control properties of the signature, including the signature appearance, reasons for signing, and the person.
See signatureSetSeedValue.
Returns
A SeedValue object.
Example: Access the seed value for a signature field.
var f = this.getField( "sig0" );
var seedValue = f.signatureGetSeedValue();
// displays the seed value filter and flags
console.println( "Filter name:" + seedValue.filter);
console.println( "Flags:" + seedValue.flags);
// displays the certificate seed value constraints
var certSpec = seedValue.certspec;
console.println( "Issuer:" + certspec.issuer);
data-id=89499
data-id=signatureinfo
data-id=id649
signatureInfo
Returns a SignatureInfo object that contains the properties of the signature. The object is a snapshot of the signature at the time that this method is called. A security handler may specify additional properties that are specific to the security handler.
Note
There are no restrictions on when this method can be called. However, the specified security handler,
oSig, may not always be available. See thesecurity.getHandler method for details.
Some properties of a signature handler, for example, certificates (a property of the SignatureInfo object), may return a null value until the signature is validated. Therefore, signatureInfo should be called again after signatureValidate.
Parameters
oSigSecurityHandler object to use to retrieve the signature properties. If not specified, the security handler is determined by the user preferences. (It is usually the handler that was used to create the signature.)Returns
A SignatureInfo object that contains the properties of the signature. This type of object is also used when signing signature fields, signing FDF objects, or with the FDF object signatureValidate method.
Example: Access SignatureInfo object properties.
// Get all info
var f = getField( "Signature1" );
f.signatureValidate();
var s = f.signatureInfo();
console.println( "Signature Attributes:" );
for(i in s) console.println( i + " = " + s[i] );
// Get particular info
var f = this.getField("Signature1"); // uses the ppklite sig handler
var Info = f.signatureInfo();
// Some standard signatureInfo properties
console.println("name = " + Info.name);
console.println("reason = " + Info.reason);
console.println("date = " + Info.date);
// Additional signatureInfo properties from PPKLite
console.println("contact info = " + Info.contactInfo);
// Get the certificate; first (and only) one
var certificate = Info.certificates[0];
// Common name of the signer
console.println("subjectCN = " + certificate.subjectCN);
console.println("serialNumber = " + certificate.serialNumber);
// Display some information about the distinguished name of signer
console.println("subjectDN.cn = " + certificate.subjectDN.cn);
console.println("subjectDN.o = " + certificate.subjectDN.o);
data-id=65475
data-id=signaturesetseedvalue
data-id=id650
signatureSetSeedValue
Sets properties that are used when signing signature fields. The properties are stored in the signature field and are not altered when the field is signed, the signature is cleared, or when resetForm is called. Use signatureGetSeedValue to obtain the property settings.
When setting seed values, keep in mind the following:
- Seed values should not be set on signed documents and cannot be set on certified documents. They are primarily used to configure fields on documents that are not yet signed.
- Setting a seed value often causes Acrobat not to display or not to use its default settings. For example, preset reasons are stored in the registry and specifying a signing reason causes the application to ignore the registry list so that only the custom reasons are displayed.
Note
The method can be executed during a batch, application initialization or console event. See priv.
Certifying signatures are signatures with a SignatureInfo object mdp property value of allowNone, default, or defaultAndComments.
Not allowed in Adobe Reader.
Refer to the Acrobat 8.0 Security Feature User Reference to obtain a deeper understanding of the use of signature seed values.
Parameters
oSigSeedValueSeedValue object containing the signature seed value properties.data-id=64991
SeedValue Object
A generic JavaScript object, passed to signatureSetSeedValue and returned by signatureGetSeedValue, which represents a signature seed value. It has the following properties:
appearanceFiltercertspecCertificateSpecifier object. see CertificateSpecifier Object for a listing of the properties of this object.digestMethodSHA1, SHA256, SHA384, SHA512, MD5, and RIPEMD160.Note
This is only applicable if the DigitalID contains RSA public/private keys. If they contain DSA public/private keys, then the value is always
SHA1.The
flagsproperty indicates whether this is a required constraint.
filter- String
- R/W
- The language-independent name of the security handler to be used when signing. If
filteris specified and theflagsproperty indicates this entry is a required constraint, then the signature handler specified by this entry must be used when signing; otherwise, signing must not take place. Ifflagsindicates that this is an optional constraint, then this handler should be used if it is available. If it is not available, a different handler can be used instead.
flagsNumber
R/W
A set of bit flags controlling which of the following properties of this object are required. The value is the logical OR of the following values, which are set if the corresponding property is required:
- 1: filter
- 2: subFilter
- 4: version
- 8: reasons
- 16: legalAttestations
- 32: shouldAddRevInfo
- 64: digestMethod*
- 128: lockDocument
- 256: appearanceFilter Usage: 1 specifies filter, 3 specifies filter and sub-filter, and 11 specifies filter, sub-filter, and reasons. If this field is not present, all properties are optional.
legalAttestations- Array of Strings
- R/W
- (Acrobat 7.0) A list of legal attestations that the user can use when creating an Modification Detection and Prevention (MDP) (certified) signature. The value of the corresponding flag in the
flagsproperty indicates whether this is a required or optional constraint.
lockDocumentString
R/W
(Acrobat 9.0) A string corrresponding to one of the three LockDocument seed value states. Values are
- auto
- true
- false Any other value will not be set.
mdp- String
- R/W
- (Acrobat 7.0) The MDP setting to use when signing the field. Values are allowNone default defaultAndComments While
allowAllis a legal value, it cancels out the effect of MDP and no certification signature can be used for this field, resulting in the signature being an approval signature, not an certification signature. Values are unique identifiers and are described in the table titled Modification Detection and Prevention (MDP) Values.
reasons- Array of Strings
- R/W
- A list of reasons that the user is allowed to use when signing. (Acrobat 8.0) If this array has a single element and that element is a single period ‘.’ and if the
reasonsare marked as required by theflagsproperty, then Acrobat 8 will suppress the UI for specifying a reason during signing. This overrides the users preference. If this array is empty andreasonsare marked as required, an exception will be thrown.
shouldAddRevInfo- Boolean
- R/W
- (Acrobat 8) If set to
true, instructs the application to carry out revocation checking of the certificate (and the corresponding chains) used to sign, and include all the revocation information within the signature. Only relevant ifsubFilterisadbe.pkcs7.detachedoradbe.pkcs7.sha1, and it is not applicable foradbe.x509.rsa_sha1. Hence, if thesubFilterisadbe.x509.rsa_sha1and it’s required that revocation information be added, then the signing operation fails. IfshouldAddRevInfoistrueand theflagsproperty indicates this is a required constraint, then the tasks described above must be performed. If they cannot be performed, then signing must fail. The default value isfalse.
subFilter- Array of Strings
- R/W
- An array of acceptable formats to use for the signature. Refer to the Signature Info object’s
subFilterproperty for a list of known formats. The first name in the array that matches an encoding supported by the signature handler should be the encoding that is actually used for signing. IfsubFilteris specified and theflagsproperty indicates that this entry is a required constraint, then the first matching encodings must be used when signing; otherwise, signing must not take place. If theflagsproperty indicates that this is an optional constraint, then the first matching encoding should be used if it is available. If it is not available, a different encoding can be used.
timeStampspec- Object
- R/W
- (Acrobat 7.0) A Seed Value timeStamp Specifier object. It uses the
urlandflagsproperties to specify a timestamp server. See Seed value timeStamp specifier object.
version- Number
- R/W
- The minimum required version number of the signature handler to be used to sign the signature field. Valid values are 1 and 2. A value of 1 specifies that the parser must be able to recognize all seed value dictionary entries specified in PDF 1.5. A value of 2 specifies that it must be able to recognize all seed value dictionary entries specified in PDF 1.7 and earlier. The
flagsproperty indicates whether this is a required constraint.
Note
The PDF Reference version 1.6 and earlier, erroneously indicates that the
Ventry (the key that corresponds to theversionparameter) is of type integer. This entry is of type real.
data-id=83422
CertificateSpecifier Object
This generic JavaScript object contains the certificate specifier properties of a signature seed value. Used in the certSpec property of the SeedValue object. This object contains the following properties:
flagsissuerCertificate objectsCertificate objects that are acceptable for signing. If specified, the signing certificate must be issued by a certificate that is an exact match with one of the certificates in this array. The value of the corresponding flag in the flags property indicates whether this is a required or optional constraint.keyUsagekeyUsage doesn’t matter. For example, if it is required that the key-usage type digitalSignature be set and the state of all other key-usage types do not matter, then the corresponding integer would be 0x7FFFFFFD. That is, to represent digitalSignature, set 01 for bits 2 and 1 respectively, and set 11 for all other key-usage types. The value of the corresponding flag in the flags property indicates whether this is a required constraint.oidissuer property is present. The value of the corresponding flag in the flags property indicates whether this is a required or optional constraint.subjectCertificate objectsCertificate objects that are acceptable for signing. If specified, the signing certificate must be an exact match with one of the certificates in this array. The value of the corresponding flag in the flags property indicates whether this is a required or optional constraint.subjectDNflags property indicates whether this is a required or optional constraint. Example 1: {cn:"Alice", ou:"Engineering", o:"Acme Inc"}. The friendly names for the DN attributes (cn, o, ou, and so on) are the ones defined in RDN (see RDN). Example 2: {cn:"Joe Smith", ou:"Engineering", "2.5.4.43":"JS"}, where OID 2.5.4.43 is used to carry out matching for the “Initials” attribute. The following is sample code to define the above DN: var subjectDN = {cn:"Joe Smith", ou:"Engineering"}; subjectDN["2.5.4.43"] = "JS"; Attributes whose value is of type DirectoryString or IA5String can be specified as shown in the example above, whereas for all other value types, for example, dateOfBirth whose value is of type GeneralizedTime, the values need to be specified as a hex-encoded binary string. For more information about the various attributes and their types, refer to RFC 3280.flags property indicates whether this is a required or optional constraint.urlTypeurl property. These are the valid values for Acrobat 8.0: * "HTML": The URL points to an HTML website and Acrobat will use the web browser to display its contents. The the value of the url bit of the flags property is ignored. * "ASSP": The URL references a signature web service that can be used for server-based signing. If the url bit of the flags property indicates that this is a required constraint, this implies that the credential used when signing must come from this server. If this attribute isn’t present, it’s assumed that the URL points to a HTML site.data-id=44704
Seed value timeStamp specifier object
The properties of the seed value timeStamp specifier object are as follows:
urlflagsExample 1: Seed the signature field, which has yet to be signed, with MDP, legal attestations, and permitted reasons for signing.
// Obtain the signature Field object:
var f = this.getField("mySigField");
f.signatureSetSeedValue({
mdp: "defaultAndComments",
legalAttestations: ["Trust me and be at ease.",
"You can surely trust the author."],
reasons: ["This is a reason", "This is a better reason"],
flags: 8
})
Example 2: Sets the signing handler as PPKMS and the format as “adbe.pkcs7.sha1”.
var f = this.getField( "mySigField" );
f.signatureSetSeedValue({
filter: "Adobe.PPKMS",
subFilter: ["adbe.pkcs7.sha1"],
flags: 3
});
Example 3: Sets the signing handler as PPKLite and the issuer of the signer’s certificate as caCert. Both are mandatory seed values and signing will fail if either constraint is not met.
var caCert = security.importFromFile("Certificate", "/C/temp/CA.cer");
f.signatureSetSeedValue({
filter: "Adobe.PPKLite",
certspec: {
issuer: [caCert],
url: "http://www.example.com/enroll.html",
flags : 2
},
flags: 1
});
data-id=20782
data-id=id652
data-id=id653
signatureSign
Signs the field with the specified security handler. See also security. getHandler and securityHandler. login.
Note
This method can only be executed during a batch, console, or application initialization event. See priv. The
eventobject contains a discussion of JavaScript events.
Signature fields cannot be signed if they are already signed. Use resetForm to clear signature fields.
Parameters
oSigSecurityHandler object to be used for signing. Throws an exception if the specified handler does not support signing operations. Some security handlers require that the user be logged in before signing can occur. If oSig is not specified, this method selects a handler based on user preferences or by prompting the user if bUI is true.oInfoSignatureInfo object specifying the writable properties of the signature. See also signatureInfo.cDIPathbUItrue, oInfo and cDIPath are used as default values in the signing dialog boxes. If false (the default), the signing occurs without a user interface.cLegalAttestmdp property of the SignatureInfo object has a value other than allowAll. When creating an certification signature, the document is scanned for legal warnings and these warnings are embedded in the document. A caller can determine what legal warnings are found by first calling the Doc getLegalWarnings method. If warnings are to be embedded, an author may provide an attestation as to why these warnings are being applied to a document.Returns
true if the signature was applied successfully, false otherwise.
Example 1: Sign the “Signature” field with the PPKLite signature handler:
var myEngine = security.getHandler( "Adobe.PPKLite" );
myEngine.login( "dps017", "/c/profile/dps.pfx" );
var f = this.getField("Signature");
// Sign the field
f.signatureSign( myEngine,
{ password: "dps017", // provide password
location: "San Jose, CA", // .
.. see note below
reason: "I am approving this document",
contactInfo: "dpsmith@example.com",
appearance: "Fancy"});
Note
In the above example, a password was provided. This may or may not have been necessary depending whether the
Password Timeouthad expired. ThePassword Timeoutcan be set programmatically bysecurityHandler.setPasswordTimeout.
Example 2: Sign an certification signature field.
var myEngine = security.getHandler( "Adobe.PPKLite" );
myEngine.login( "dps017", "/c/profile/dps.pfx" );
var f = this.getField( "AuthorSigFieldName" );
var s = { reason: "I am the author of this document",
mdp: "allowNone" };
f.signatureSign({
oSig: myEngine,
oInfo: s,
bUI: false,
cLegalAttest: "To reduce file size, fonts are not embedded."
});
data-id=95248
data-id=id654
data-id=id655
signatureValidate
Validates and returns the validity status of the signature in a signature field. This routine can be computationally expensive and take a significant amount of time depending on the signature handler used to sign the signature.
Note
There are no restrictions on when this method can be called. However, the parameter
oSigis not always available. Seesecurity.getHandler for details.
Parameters
oSigSecurityHandler object or a SignatureParameters object. If this handler is not specified, the method uses the security handler returned by the signature’s handlerName property.bUItrue, allows the UI to be shown when validating, if necessary. The UI may be used to select a validation handler if none is specified. The default is false.Returns
The validity status of the signature. Validity values are:
- -1: Not a signature field
- 0: Signature is blank
- 1: Unknown status
- 2: Signature is invalid
- 3: Signature of document is valid, identity of signer could not be verified
- 4: Signature of document is valid and identity of signer is valid.
See the signVisible and statusText properties of the SignatureInfo object.
data-id=91834
SignatureParameters object
A generic object with the following properties that specify which security handlers are to be used for validation by signatureValidate :
oSecHdlrbAltSecHdlrtrue, an alternate security handler, selected based on user preference settings, may be used to validate the signature. The default is false, which means that the security handler returned by the signature’s handlerName property is used to validate the signature. This parameter is not used if oSecHdlr is provided.Example: Validate a signature, then report to the console.
var f = this.getField("Signature1") // Get signature field
var status = f.signatureValidate();
var sigInfo = f.signatureInfo();
if ( status < 3 )
var msg = "Signature not valid! " + sigInfo.statusText;
else
var msg = "Signature valid! " + sigInfo.statusText;
app.alert(msg);
data-id=16267
data-id=id656
data-id=id657
FullScreen
The interface to fullscreen (presentation mode) preferences and properties. To acquire a fullScreen object, use app.fs.
data-id=fullscreen-properties
data-id=id658
FullScreen properties
data-id=95727
data-id=backgroundcolor
data-id=id659
backgroundColor
The background color of the screen in full screen mode. See Color arrays for details.
Example:
app.fs.backgroundColor = color.ltGray;
data-id=12908
data-id=clickadvances
data-id=id660
clickAdvances
Specifies whether a mouse click anywhere on the page causes the page to advance.
data-id=43744
data-id=cursor
data-id=id661
cursor
Determines the behavior of the pointer in full screen mode. The convenience cursor object defines all the valid cursor behaviors:
cursor.hiddencursor.delaycursor.visibleExample:
app.fs.cursor = cursor.visible;
data-id=46194
data-id=defaulttransition
data-id=id662
defaultTransition
The default transition to use when advancing pages in full screen mode. Use transitions to obtain list of valid transition names supported by the viewer.
“No Transition” is equivalent to app.fs.defaultTransition = "";
Example: Put the document into presentation mode.
app.fs.defaultTransition = "WipeDown";
app.fs.isFullScreen = true;
data-id=54221
data-id=escapeexits
data-id=id663
escapeExits
A Boolean value specifying the escape key can be used to exit full screen mode.
Note
(Version 8.0) This property can only set to
falseduring batch and console events. See priv. Theeventobject contains a discussion of JavaScript events.
data-id=11586
data-id=isfullscreen
data-id=id664
isFullScreen
If true, the viewer is in full screen mode rather than regular viewing mode, which is possible only if one or more documents are open for viewing.
Note
A PDF document being viewed from within a web browser cannot be put into full screen mode.
Example:
app.fs.isFullScreen = true;
In the above example, the viewer is set to full screen mode. If isFullScreen was previously false, the default viewing mode would be set. (The default viewing mode is defined as the original mode the Acrobat application was in before full screen mode was initiated.)
data-id=70106
data-id=loop
data-id=id665
loop
Specifies whether the document will loop around to the beginning of the document in response to a page advance (whether generated by mouse click, keyboard, or timer) in full screen mode.
data-id=11728
data-id=timedelay
data-id=id666
timeDelay
The default number of seconds before the page automatically advances in full screen mode. See useTimer to activate or deactivate automatic page turning.
Example: Set full screen properties, then go into full screen mode.
app.fs.timeDelay = 5; // Delay 5 seconds
app.fs.useTimer = true; // Activate automatic page turning
app.fs.usePageTiming = true; // Allow page override
app.fs.isFullScreen = true; // Go into full screen
data-id=85692
data-id=transitions
data-id=id667
transitions
An array of strings representing valid transition names implemented in the viewer. No Transition is equivalent to setting defaultTransition to the empty string:
app.fs.defaultTransition = "";
Example: Produce a listing of the currently supported transition names.
console.println("[" + app.fs.transitions + "]");
data-id=70905
data-id=usepagetiming
data-id=id668
usePageTiming
Specifies whether automatic page turning will respect the values specified for individual pages in full screen mode. Set transition properties of individual pages using setPageTransitions.
data-id=88396
data-id=usetimer
data-id=id669
useTimer
Specifies whether automatic page turning is enabled in full screen mode. Use timeDelay to set the default time interval before proceeding to the next page.
data-id=12440
data-id=global
data-id=id670
global
This is a static JavaScript object that allows you to share data between documents and to have data be persistent across sessions. Such data is called persistent global data. Global data-sharing and notification across documents is done through a subscription mechanism, which allows you to monitor global data variables and report their value changes across documents.
Note
Beginning with version 8.0, the access to global variables has changed somewhat, the details are described below:
The JavaScript category in the Preferences dialog box (Ctrl + K) has a new security check box: Enable Global Object Security Policy.
- When checked, the default, each time a global variable is written to, the origin which set it is remembered. Only origins that match can then access the variable.
- For files, this means only the file that set it, having the same path it had when the variable was set, can access the variable.
- For documents from URLs it means only the host which set it can access the variable.
There is an important exception to the restrictions described above, global variables can be defined and accessed in a privileged context, in the console, in a batch sequence and in folder JavaScript. For more information on privileged contexts, see priv.
- When not checked, documents from different origins are permitted to access the variable; this is the behavior previous to version 8.0.
For examples, see section Global object security policy.
data-id=creating-global-properties
data-id=id671
Creating global properties
You can specify global data by adding properties to the global object. The property type can be a String, a Boolean value, or a Number.
For example, to add a variable called radius and to allow all document scripts to have access to this variable (provided “Enable global object security policy” is not checked), the script defines the property:
global.radius = 8;
The global variable radius is now known across documents throughout the current viewer session. Suppose two files, A.pdf and B.pdf, are open and the global declaration is made in A.pdf. From within either file (A.pdf or B.pdf), you can calculate the volume of a sphere using global.radius.
var V = (4/3) * Math.PI * Math.pow(global.radius, 3);
In either file, you obtain the same result, 2144.66058. If the value of global.radius changes and the script is executed again, the value of V changes accordingly.
data-id=deleting-global-properties
data-id=id672
Deleting global properties
To delete a variable or a property from the global object, use the delete operator to remove the defined property. Information on the reserved JavaScript keyword delete can be found in the JavaScript 1.5 documentation.
For example, to remove the global.radius property, call the following script:
delete global.radius
data-id=66001
data-id=global-object-security-policy
data-id=id673
Global object security policy
The new global security policy places restrictions on document access to global variables. For more information and exceptions, see the Note in global.
In a document, named docA.pdf, execute the following script in a non-privileged context (mouse-up button):
global.x = 1
global.setPersistent("x", true);
The path for docA.pdf is the origin saved with the global.x variable; consequently, docA.pdf can access this variable:
console.println("global.x = " + global.x);
To set this global from docA.pdf, we execute global.x = 3, for example, in any context.
To have a document with a different path get and set this global variable, the getting and setting must occur in a trusted context, with a raised level of privilege. The following scripts are folder JavaScript.
myTrustedGetGlobal = app.trustedFunction ( function()
{
app.beginPriv();
var y = global.x;
return y
app.endPriv();
});
myTrustedSetGlobal = app.trustedFunction ( function(value)
{
app.beginPriv();
global.x=value;
app.endPriv();
});
Another document, docB.pdf can access the global.x variable through the above trusted functions:
// Mouse up button action from doc B
console.println("The value of global.x is " + myTrustedGetGlobal());
The global can also be set from docB.pdf:
// Set global.x from docB.pdf
myTrustedSetGlobal(2);
Once global.x has been set from docB.pdf, the origin is changed; docA.pdf cannot access global.x directly unless it is through a trusted function:
// Execute a mouse up button action from docA.pdf
console.println("The value of global.x is " + myTrustedGetGlobal());
data-id=global-methods
data-id=id674
global methods
data-id=42685
data-id=setpersistent
data-id=id675
setPersistent
Controls whether a specified variable is persistent across invocations of Acrobat.
Persistent global data only applies to variables of type Boolean, Number, or String.
Upon application exit, persistent global variables are stored in the glob.js file located in the user’s folder for folder-level scripts and re-loaded at application start. For Acrobat 6.0 or later, there is a 2-4 KB limit on the size of this file. Any data added to the string after this limit is dropped.
When specifying persistent global variables, you should use a naming convention. For example, you can give your variables the form myCompany_variableName. This prevents collisions with other persistent global variable names throughout the documents.
Parameters
cVariablebPersisttrue, the property will exist across Acrobat viewer sessions. If false (the default) the property will be accessible across documents but not across the Acrobat viewer sessions.Example: Make the radius property persistent and accessible for other documents.
global.radius = 8; // Declare radius to be global
global.setPersistent("radius", true); // Now say it's persistent
The volume calculation, defined above, will now yield the same result across viewer sessions, or until the value of global.radius is changed.
data-id=28547
data-id=subscribe
data-id=id676
subscribe
Allows you to automatically update fields when the value of a global variable changes. If the specified property cVariable is changed, even in another document, the specified function fCallback is called. Multiple subscribers are allowed for a published property.
Parameters
cVariablefCallbackThe syntax of the callback function is as follows:
function fCallback(newval) {
// newval is the new value of the global variable you
// have subscribed to.
< code to process the new value of the global variable >
}
The callback will be terminated when the document from which the script was originally registered is closed, or the (global) property deleted.
Example: In this example, it is assumed that Enable Global Object Security Policy is not checked. There are two files, setRadius.pdf and calcVolume.pdf, open in Acrobat or Adobe Reader:
setRadius.pdf has a single button with the code
global.radius = 2;
The calcVolume.pdf has a document-level JavaScript named subscribe :
global.subscribe("radius", RadiusChanged);
function RadiusChanged(x) // callback function
{
var V = (4/3) * Math.PI * Math.pow(x,3);
this.getField("MyVolume").value = V; // Put value in text field
}
With both files open, clicking on the button in setRadius.pdf immediately gives an update in the text field “MyVolume” in calcVolume.pdf of 33.51032 (as determined by global.radius = 2).
data-id=29659
data-id=hostcontainer
data-id=id677
HostContainer
This object manages communication between a PDF document and a corresponding host container that the document is contained within, such as an HTML page. The host container for a document is specified by the Doc hostContainer property.
The Embedded PDF object provides the corresponding API for the object model of the container application.
data-id=hostcontainer-properties
data-id=id678
HostContainer properties
data-id=85023
data-id=id679
data-id=id680
messageHandler
A notification object that is called if a script in the host container calls the postMessage method. This object may expose the following methods and properties:
onMessagepostMessage. The message is delivered asynchronously. The method is passed a single array parameter containing the array that was passed to postMessage.onErrorError object and an array of strings corresponding to the message that caused the error. The name property of the Error object is set to one of these: * "MessageGeneralError": A general error occurred. * "MessageNotAllowedError": The operation failed for security reasons. If an error occurs and this property is undefined, the error will not be delivered (unlike messages, errors are not queued).onDiscloseDoc/Open event. The method is passed two parameters: * cURL: The URL indicating the location of the host container (for example, the URL of an HTML page using an <OBJECT> tag). * cDocumentURL: The URL of the PDF document that disclosure is being checked for. If the method returns true, the host container is permitted to post messages to the message handler.allowDeliverWhileDocIsModalfalse), messages and errors are queued and not delivered to the onMessage and onError handlers if the application is currently displaying a modal dialog. The app.isModal property can be used to detect this case.Note
Instead of specifying a method,
onDisclosemay specify the valueHostContainerDisclosurePolicy.SameOriginPolicy, which means that the document will be disclosed to the host container if they both originate from the same location. In this case, the origination is determined by the scheme, server, and port. The scheme must behttp,https, orftpfor the document to be disclosed.
When these methods are invoked, the this object will be the messageHandler instance that the method is being called on.
Other methods and properties can be added to messageHandler provided that they do not begin with on.
If messageHandler is set to null or an object without an onMessage method, messages sent by postMessage are queued until the property is set to a valid messageHandler instance.
Messages are guaranteed to be delivered in the order in which they are posted and errors are guaranteed to be delivered in the order in which they occurred. However, there is no correspondence between the delivery order of messages and errors.
Exceptions thrown from within the handler methods will be discarded. If an exception is thrown from within onDisclose, the function will be treated as a failure. Messages and errors will not be delivered while inside an onMessage / onError / onDisclose handler.
Example: A generic host container message handler.
this.hostContainer.messageHandler =
{
onMessage: function(aMessage)
{
for(var i = 0; i < aMessage.length; i++)
console.println("Recv'd Msg[ " + i + "]: " + aMessage[i]);
},
onError: function(error, aMessage){ },
onDisclose: HostContainerDisclosurePolicy.SameOriginPolicy
};
data-id=hostcontainer-methods
data-id=id681
HostContainer methods
data-id=90555
data-id=id682
data-id=id683
postMessage
Sends a message asynchronously to the message handler for the host container of the PDF document. For this message to be delivered, the host container (for example, an <OBJECT> element in an HTML page) must have registered for notification by setting its messageHandler property. The message is passed to the onMessage method of the messageHandler.
The messages are submitted to a queue until they are delivered. If the queue exceeds a maximum number of messages, a parameter error is thrown until some of the messages in the queue have been delivered.
Parameters
aMessageonMessage method of the messageHandler property.Example:
var aMessage = ["MyMessageName", "Message Body"];
this.hostContainer.postMessage(aMessage);
data-id=73868
data-id=icon
data-id=id684
Icon
This generic JavaScript object is an opaque representation of a Form XObject appearance stored in the Doc icons property. It is used with Field objects of type button. The icon object contains the following property:
namedata-id=48588
data-id=icon-stream
data-id=id685
Icon Stream
This generic JavaScript object represents an icon stream. It is used by app.addToolButton and collab.addStateModel. It has the following properties:
read(nBytes)widthheightThe util.iconStreamFromIcon method can be used to convert an Icon object to an Icon Stream object.
data-id=68797
data-id=identity
data-id=id686
identity
This is a static object that identifies the current user of the application.
Note
The
identityobject properties are only accessible during batch, console and application initialization events to protect the privacy of the user. See priv.
data-id=identity-properties
data-id=id687
identity properties
data-id=69829
data-id=corporation
data-id=id688
corporation
The corporation name that the user has entered in the Identity preferences panel.
data-id=33868
data-id=email
data-id=id689
The email address that the user has entered in the Identity preferences panel.
data-id=98507
data-id=loginname
data-id=id690
loginName
The login name as registered by the operating system.
data-id=95607
data-id=id691
data-id=id692
name
The user name that the user entered in the Identity preferences panel.
Example: The following can be executed in the console, or, perhaps, a folder-level JavaScript.
console.println("Your name is " + identity.name);
console.println("Your e-mail is " + identity.email);
data-id=95590
data-id=index
data-id=id693
Index
An object that represents a Catalog-generated index. It is non-creatable and returned by various methods of the search object and catalog object. You use this object to perform various indexing operations using Catalog. You can find the status of the index with a search.
data-id=index-properties
data-id=id694
Index properties
data-id=32844
data-id=available
data-id=id695
available
Specifies whether the index is available for selection and searching. An index may be unavailable if a network connection is down or a CD-ROM is not inserted, or if the index administrator has brought the index down for maintenance purposes.
data-id=21497
data-id=id696
data-id=id697
name
The name of the index as specified by the index administrator at indexing time.
See search. indexes, which returns an array of the Index objects currently accessed by the search engine.
Example: This example enumerates all of the indexes and writes their names to the console.
for (var i = 0; i < search.indexes.length; i++) {
console.println("Index[" + i + "] = " + search.indexes[i].name);
}
data-id=46342
data-id=id698
data-id=id699
path
The device-dependent path where the index resides. See the PDF Reference for exact syntax of the path.
data-id=35848
data-id=selected
data-id=id701
selected
Specifies whether the index participates in the search. If true, the index is searched as part of the query. If false it is not searched. Setting or unsetting this property is equivalent to checking the selection status in the index list dialog box.
data-id=index-methods
data-id=id702
Index methods
data-id=15721
data-id=build
data-id=id703
build
Builds the index associated with the Index object using the Catalog plug-in. This method does not build a new index.
The index is built at the same location as the index file. If the index already exists, the included directories are scanned again for changes and the index is updated. If the index does not exist, a new index can be defined and built through the user interface.
If Catalog is idle, the index build is started immediately; otherwise, it gets queued with Catalog.
Note
(Acrobat 7.0) This method can only be executed during a batch or console event. See priv. The event object contains a discussion of JavaScript events.
Parameters
cExprbRebuildAlltrue, a clean build is performed. The index is first deleted and then built. The default is false.Returns
A CatalogJob object that can be used to check the job parameters and status.
Example:
/* Building an index */
if (typeof catalog != "undefined") {
var idx = catalog.getIndex("/c/mydocuments/index.pdx");
var job = idx.build("Done()", true);
console.println("Status : ", job.status);
}
data-id=48288
data-id=link
data-id=id705
Link
This object is used to set and get the properties and to set the JavaScript action of a link.
Link objects can be obtained from the Doc methods addLink or getLinks. (See also removeLinks.)
data-id=link-properties
data-id=id706
Link properties
data-id=38599
data-id=bordercolor
data-id=id707
borderColor
The border color of a Link object. See Color arrays for information on defining color arrays and how colors are used with this property.
data-id=89645
data-id=borderwidth
data-id=id708
borderWidth
The border width of the Link object.
data-id=41034
data-id=highlightmode
data-id=id709
highlightMode
The visual effect to be used when the mouse button is pressed or held down inside an active area of a link. The valid values are:
None
Invert
Outline
Push
The default is Invert.
data-id=29424
data-id=id710
data-id=id711
rect
The rectangle in which the link is located on the page. Contains an array of four numbers, the coordinates in rotated user space of the bounding rectangle, listed in the following order: upper-left x, upper-left y, lower-right x and lower-right y.
data-id=link-methods
data-id=id712
Link methods
data-id=91831
data-id=id713
data-id=id714
setAction
Sets the specified JavaScript action for the MouseUp trigger for the Link object.
Note
This method will overwrite any action already defined for this link.
Parameters
cScriptdata-id=86741
data-id=monitor
data-id=id715
Monitor
A Monitor object represents an individual display monitor. A Monitor object can be obtained from app.monitors, which returns an array of all monitors connected to the system. app.monitors is a Monitors object so the methods of the Monitors object can be used to select or filter out monitors from a multiple monitor system based on different criteria. See the Monitors object for details.
The Monitor object and the Monitors object are used in the MediaSettings monitor property.
data-id=monitor-properties
data-id=id716
Monitor properties
data-id=17958
data-id=colordepth
data-id=id717
colorDepth
The color depth of the monitor; that is, the number of bits per pixel.
data-id=32631
Example: Get the primary monitor and check its color depth. The Monitors.primary method is use to select the primary monitor.
var monitors = app.monitors.primary();
console.println( "Color depth of primary monitor is "
+ monitors[0].colorDepth );
data-id=30012
data-id=isprimary
data-id=id718
isPrimary
A Boolean value that is true for the primary monitor, false for all other monitors.
data-id=24432
Example: Get the widest monitor and determine if it is the primary monitor.
var monitors = app.monitors.widest();
var isIsNot = (monitors[0].isPrimary) ? "is" : "is not";
console.println("The widest monitor "+isIsNot+" the primary monitor.");
data-id=62397
data-id=id719
data-id=id720
rect
A rectangle specifying the boundaries of the monitor in virtual desktop coordinates:
- The origin of the virtual desktop is the top left corner of the primary monitor. Therefore, the primary monitor’s bounds are always in the form [ 0, 0, right, bottom ].
- Secondary monitors may have positive or negative values in their bounds arrays, depending on where they are positioned relative to the primary monitor.
data-id=48528
data-id=workrect
data-id=id721
workRect
A rectangle representing a monitor’s workspace boundaries in virtual desktop coordinates. See rect for information about these coordinates.
The workspace is the area of a monitor that is normally used for applications, omitting any items such as docked toolbars or taskbars. For example, running Windows on a single 800x600 display, rect is [ 0, 0, 800, 600 ]. With a standard Windows taskbar 30 pixels high and always visible at the bottom of the screen, workRect is [ 0, 0, 800, 570 ].
data-id=57963
data-id=id722
data-id=id723
Monitors
A Monitors object is equivalent to a read-only array of Monitor objects, each one representing a single monitor. Elements can be accessed using the usual array notation and the length property.
The app.monitors property returns a Monitors object that includes every monitor connected to the user’s system. JavaScript code can loop through this array to get information about the available monitors and select one for a full screen or pop-up media player.
Note
The Monitors object returned by
app.monitorsis unsorted (the monitors are not listed in any particular order).
The Monitors object has a number of filter methods that select one or more monitors based on various criteria. All of the monitor selection options provided in the PDF file format are implemented as calls to these filter methods.
None of the filter methods modify the original Monitors object. They each return a new Monitors object, which normally contains one or more Monitor objects. If a single monitor matches the filtering criterion better than any other, the result Monitors object contains that monitor. If more than one monitor satisfies the filtering criterion equally (for example, for the bestColor method, if more than one monitor has the same greatest color depth), the result contains all of those monitors.
Several of the filter methods have an optional minimum or required parameter. If this parameter is specified and no monitor meets that minimum requirement, the result Monitors object is empty. Otherwise, if the original Monitors object was not empty, the result always contains at least one monitor.
Wherever a filter method refers to height, width, or area, the dimensions are in pixels.
Example:
var monitors = app.monitors;
for ( var i = 0; i< monitors.length; i++)
console.println("monitors["+i+"].colorDepth = "+monitors[i].colorDepth);
Monitors.length contains the number of elements in the Monitors object. For the Monitors object returned by app.monitors, this is the number of monitors in the user’s system. For a Monitors object returned by one of the filter methods, this number may be smaller.
data-id=monitors-methods
data-id=id724
Monitors methods
data-id=59721
data-id=bestcolor
data-id=id725
bestColor
Returns a copy of the Monitors object, filtered to include the monitor or monitors with the greatest color depth.
If nMinColor is specified, returns an empty Monitors array if the best color depth is less than nMinColor.
Parameters
nMinColorReturns
A Monitors object
Example:
var monitors = app.monitors.bestColor(32);
if (monitors.length == 0 )
console.println("Cannot find the required monitor.");
else
console.println("Found at least one monitor.");
data-id=85937
data-id=bestfit
data-id=id726
bestFit
Returns a copy of the Monitors object, filtered to include only the smallest monitor or monitors with at least the specified nWidth and nHeight in pixels.
Parameters
nWidthnHeightbRequiretrue, the method returns an empty Monitors array. If false or omitted, a Monitors array containing the largest monitor or monitors is returned.Returns
A Monitors object
data-id=31310
data-id=desktop
data-id=id727
desktop
Creates a new Monitors object containing one Monitor object that represents the entire virtual desktop. The rect property is the union of every rect in the original Monitors object, the workRect property is the union of every workRect in the original Monitors object, and colorDepth is the minimum colorDepth value found in the original Monitors object.
Returns
A Monitors object
Note
The
desktopmethod is normally called directly on a Monitors object returned byapp.monitors. If that Monitors object is first filtered by any of its other methods, thedesktopmethod does the same calculations listed above with that subset of the monitors.
data-id=17611
data-id=document
data-id=id728
document
Returns a copy of the Monitors object, filtered to include the monitor or monitors that display the greatest amount of the document, as specified by the Doc parameter doc.
If the document does not appear on any of the monitors in the original Monitors object, the method returns an empty Monitors array if bRequire is true or a Monitors array containing at least one arbitrarily chosen monitor from the original array if bRequire is false or omitted.
Parameters
docbRequireReturns
A Monitors object
data-id=60526
data-id=filter
data-id=id729
filter
Returns a copy of the Monitors object, filtered by calling a ranker function for each monitor in the list. The ranker function takes a Monitor parameter and returns a numeric rank. The return value from filter is a Monitors array containing the monitors that had the highest rank (either a single monitor, or more than one if there was a tie).
Parameters
fnRankernMinRanknMinRank is undefined, filter always includes at least one monitor from the original list (unless the original list was empty). If nMinRank is specified, filter returns an empty Monitors array if no monitors had at least that rank according to the ranker function.Returns
A Monitors object
Note
Most of the other Monitors filtering functions are implemented as
filtercalls.
Example: This script implements Monitors.bestColor( minColor). It returns a Monitors object containing the monitor or monitors that have the greatest color depth. If minColor is specified, returns an empty Monitors array if the best color depth is less than minColor.
bestColor: function( minColor )
{
return this.filter(
function( m ) { return m.colorDepth; }, minColor );
}
data-id=99555
data-id=largest
data-id=id730
largest
Returns a copy of the Monitors object, filtered to include the monitor or monitors with the greatest area in pixels.
Parameters
nMinAreanMinArea, a number, is specified, largest() returns an empty Monitors array if that greatest area is less than that value.Returns
A Monitors object
data-id=73436
data-id=leastoverlap
data-id=id731
leastOverlap
Returns a copy of the Monitors object, filtered to include the monitor or monitors that contain the smallest amount of the rectangle, as specified by the rect parameter.
Parameters
rectmaxOverlapAreamaxOverlapArea is specified, the result Monitors array contains only those monitors that contain at least that much area of the rectangle, or an empty Monitors array if no monitors contain that much area of the rectangle.Returns
A Monitors object
data-id=36907
data-id=mostoverlap
data-id=id732
mostOverlap
Returns a copy of the Monitors object, filtered to include the monitor or monitors that contain the largest amount of the rectangle, as specified by the rect parameter.
If there is no monitor with at least that much overlapping area, the method returns an empty Monitors array if minOverlapArea is specified, or a Monitors array containing at least one arbitrarily chosen monitor from the original array if minOverlapArea is omitted.
Parameters
rectminOverlapAreaReturns
A Monitors object
data-id=74274
data-id=nondocument
data-id=id733
nonDocument
Returns a copy of the Monitors object, filtered to include the monitor or monitors that display none of, or the least amount of, the document.
Parameters
docbRequirebRequire is a Boolean value that determines the return value when there is no monitor that is completely clear of the document. If true, nonDocument returns an empty, or if false or omitted, nonDocument returns a Monitors array containing at least one arbitrarily chosen monitor from the original Monitors array.Returns
A Monitors object
data-id=20098
data-id=primary
data-id=id734
primary
Returns a copy of the Monitors object, filtered by removing all secondary monitors, leaving only the primary monitor if it was present in the original list.
If the primary monitor was not present in the original list, returns a Monitors array containing at least one arbitrarily chosen monitor from the original list.
Returns
A Monitors object
data-id=27587
Example: Get the primary monitor and check its color depth.
var monitors = app.monitors.primary();
// Recall that each element in a monitors object is a monitor object
// This code uses monitor.colorDepth
console.println( "Color depth of primary monitor is "
+ monitors[0].colorDepth );
data-id=90658
data-id=secondary
data-id=id735
secondary
Returns a copy of the Monitors object, filtered by removing the primary monitor, returning only secondary monitors.
If the original Monitors object contained only the primary monitor and no secondary monitors, returns the original list.
Returns
A Monitors object
data-id=32009
data-id=select
data-id=id736
select
Returns a copy of the Monitors object, filtered according nMonitor, a monitor selection value as used in PDF and enumerated in app.media.monitorType.
The doc is required when nMonitor is app.media.monitorType.document or app.media.monitorType.nonDocument and ignored for all other nMonitor values.
These selection values correspond directly to the various Monitors filter methods. select calls the corresponding filter method and then, in most cases, also filters with primary as a tie-breaker in case more than one monitor matches the main filter.
Parameters
nMonitorapp.media.monitorType.docnMonitor is either app.media.monitorType.document or app.media.monitorType.nonDocument, ignored otherwise.Returns
A Monitors object.
Example: These two equivalent methods are for filtering monitors.
settings.monitor =
app.monitors().select( app.media.monitorType.document, doc );
settings.monitor = app.monitors().document(doc).primary();
data-id=30414
data-id=tallest
data-id=id737
tallest
Returns a copy of the Monitors object, filtered to include only the monitor or monitors with the greatest height in pixels.
Parameters
nMinHeightnMinHeight is specified and no monitor has at least that height, the return value is an empty Monitors array.Returns
A Monitors object
data-id=46128
data-id=widest
data-id=id738
widest
Returns a copy of the Monitors object, filtered to include only the monitor or monitors with the greatest width in pixels.
Parameters
nMinWidthReturns
A Monitors object
data-id=78835
data-id=net
data-id=id739
Net
The Net object allows for the discovery and access to networking services through a variety of protocols.
The Net object forms a namespace for the networking services that currently exist in the global namespace (SOAP). The existing objects will be maintained for backwards-compatibility however any new services should use the new namespace.
data-id=83901
data-id=net-properties
data-id=id740
Net properties
data-id=63722
data-id=soap
data-id=id741
SOAP
The Net.SOAP object allows for communication with network services that use the SOAP Messaging Protocol. The Net.SOAP object has one property and three method. See the referenced link for full documentation.
true, synchronous SOAP requests will cause the XML Request and Response to be dumped to the JavaScript Console. This is useful for debugging SOAP problems.data-id=17451
data-id=discovery
data-id=id742
Discovery
The Discovery object allows for the dynamic discovery of network services. The Net.Discovery object has two methods. See the referenced link for full documentation.
data-id=85823
data-id=http
data-id=id743
HTTP
The Net.HTTP object allows access to web services that use HTTP. These methods allow communication with a wider variety of services than the Net.SOAP object. The HTTP object can be used to implement any messaging protocol that utilizes HTTP, for example, WebDAV or the ATOM Publishing Protocol.
See Net.HTTP for full documentation of the methods of the HTTP object.
data-id=24131
data-id=net-methods
data-id=id744
Net methods
The Net object has three methods. See the referenced link for full documentation.
data-id=37414
data-id=net-http
data-id=id745
Net.HTTP
The Net.HTTP object allows access to web services that use HTTP. These methods allow communication with a wider variety of services than the Net.SOAP object. The HTTP object can be used to implement any messaging protocol that utilizes HTTP, for example, WebDAV or the ATOM Publishing Protocol.
data-id=net-http-methods
data-id=id746
Net.HTTP methods
data-id=99486
data-id=request
data-id=id747
request
The request method asynchronously invokes an HTTP Web Service. This method allows connecting to a wider set of web services than the Net.SOAP.request (SOAP.request) method and with finer control over the HTTP method, headers and / or body. This method allows the creation of more complicated networking protocols such as WebDAV or the Atom Publishing Protocol.
Note
This method can only be made outside the context of a document (for example, in a folder level JavaScript).
Parameters
cVerbcURLaHeadersname: The name of the header to use, this must be a valid HTTP Header name. * value: The value for the HTTP header, this must be a valid HTTP Header value string.oRequestoHandleroHandler object will have the response method invoked with the following parameters: * oRequest: The response body as a stream object on success. * cURL: The request URL that was used when this request was invoked. * oException: An exception object if the method was not successful. The exception object has the following properties: * error: The HTTP status code that was returned. * msg: An error message associated with the failure. * aHeaders: An array of response headers returned from the server. See the aHeaders parameter of the Net.HTTP.request method for a description of the format.oAuthenticateoAuthenticate object can have the following properties: * Username: A string containing the username to use for authentication. * Password: A string containing the authentication credential to use. * UsePlatformAuth: A Boolean indicating that platform authentication should be used. If platform authentication is enabled, the Username and Password are ignored and the underlying platform networking code is used. This may cause an authentication UI to be shown to the user and/or the credentials of the currently logged in user to be used. The default is false and is only supported on the Windows platform.Exceptions
The method throws an exception if the URL is invalid or the same, origin requirement is not satisfied.
Example: Create a collection at the URL specified.
CreateWebDAVCollection = function(cURL)
{
var params =
{
cVerb: "MKCOL",
cURL: cURL,
oHandler:
{
response: function(msg, uri, e)
{
// HTTP 405 - Can't MKCOL if it exists!
if(e != undefined && e.error != 405) {
app.alert("Failed to MKCOL: "+ e);
} else app.alert("Created collection");
}
}
};
Net.HTTP.request(params);
} // CreateWebDAVCollection
data-id=66402
data-id=ocg
data-id=id748
OCG
An OCG object represents an optional content group in a PDF file. Content in the file can belong to one or more optional content groups. Content belonging to one or more OCGs is referred to as optional content and its visibility is determined by the states (ON or OFF) of the OCGs to which it belongs. In the simplest case, optional content belongs to a single OCG, with the content being visible when the OCG is on and hidden when the OCG is off. More advanced visibility behavior can be achieved by using multiple OCGs and different visibility mappings.
Use the Doc getOCGs method to get an array of OCG objects for a PDF document.
The Doc methods addWatermarkFromFile and addWatermarkFromText add watermarks in an OCG.
See the PDF Reference for additional details on optional content groups.
data-id=ocg-properties
data-id=id750
OCG properties
data-id=78529
data-id=id751
data-id=id752
constants
Each instance of an OCG object inherits this property, which is a wrapper object for holding various constant values.
data-id=68717
intents Object
An OCG’s intent array can contain arbitrary strings, but those contained in this object are the only ones recognized by Acrobat.
designviewdata-id=73206
states Object
The states object is used to set the initial state of the OCG (see initState).
onoffdata-id=34918
data-id=initstate
data-id=id753
initState
This property is used to determine whether this OCG is on or off by default. See the states Object for possible values.
Example: Set an initial state of an OCG to off.
var ocgs = this.getOCGs();
ocgs[0].initState.constants.states.off;
data-id=16397
data-id=locked
data-id=id754
locked
This property is used to determine whether this OCG is locked. If an OCG is locked, its on/off state cannot be toggled through the UI.
data-id=90593
data-id=id755
data-id=id756
name
The text string seen in the UI for this OCG. It can be used to identify OCGs, although it is not necessarily unique.
Note
In Acrobat 6.0, the
nameis read-only; for Acrobat 7.0, it is read/write.
Example: A function that toggle all Watermark OCGs.
function ToggleWatermark(doc)
{
var ocgArray = doc.getOCGs();
for (var i=0; i < ocgArray.length; i++) {
if (ocgArray[i].name == "Watermark") {
ocgArray[i].state = !ocgArray[i].state;
}
}
}
data-id=24633
data-id=id757
data-id=id758
state
Represents the current on/off state of this OCG.
Changing the state of an OCG does not dirty the document, the OCGs revert to their initial state when the document is loaded again.
Example: Turn on all the OCGs in the given document.
function TurnOnOCGsForDoc(doc)
{
var ocgArray = doc.getOCGs();
for (var i=0; i < ocgArray.length; i++)
ocgArray[i].state = true;
}
data-id=ocg-methods
data-id=id759
OCG methods
data-id=71160
data-id=getintent
data-id=id760
getIntent
Returns this OCG’s intent array.
An OCG will affect the visibility of content only if it has onstants.intents.view as an intent.
See also setIntent and the intents Object.
Returns
An array of strings. See constants.intents for possible values.
data-id=39535
data-id=id761
data-id=id762
setAction
Registers a JavaScript expression to be evaluated after every state change for this OCG.
Setting an action for an OCG does not dirty the document, therefore, the assignment of action must be made when the document is first opened, as document level script, or dynamically through user interaction.
Note
This method will overwrite any action already defined for this OCG.
Parameters
cExprExample: The function below is used to assign a beep sound to an OCG passed to it. The script that follows the function definition assigns a beeping action to the first OCG, as listed in the array returned by the getOCGs method.
/* Beep when the given ocg is changed */
function BeepOnChange(ocg)
{
ocg.setAction("app.beep()");
}
var ocgs = this.getOCGs();
BeepOnChange(ocgs[0]);
data-id=15064
data-id=setintent
data-id=id763
setIntent
Sets this OCG’s intent array. An OCG should only affect the visibility of content if this array contains constants.intents.view. See the intents Object for possible values.
See also getIntent and the intents Object.
Parameters
aIntentArrayExample: Set the intent of all OCGs in the document to both View and Design.
var ocgs = this.getOCGs();
for (i=0; i < ocgs.length; i++) {
ocgs[i].setIntent( [ocgs[i].constants.intents.view,
ocgs[i].constants.intents.design]);
}
data-id=58967
PlayerInfo
A PlayerInfo object represents a media player that is available for media playback. The app.media.getPlayers method returns a PlayerInfoList object, which is a collection of PlayerInfo objects.
data-id=playerinfo-properties
data-id=id764
PlayerInfo properties
data-id=26289
data-id=id
data-id=id765
id
Represents a media player plug-in and associated media player. This string is not localized and is not intended for display to the user. This string may be used in the MediaPlayer.settings.players array when creating a MediaPlayer, and it is also found in the MediaPlayer.id property after opening a player.
Example: List player information for all media players that play “video/mpeg”.
var playerInfoList = app.media.getPlayers("video/mpeg");
for ( var i=0; i < playerInfoList.length; i++) {
console.println("id: " + playerInfoList[i].id)
console.println("name: " + playerInfoList[i].name)
console.println("version: " + playerInfoList[i].version)
}
data-id=22221
data-id=mimetypes
data-id=id766
mimeTypes
An array of strings listing the MIME types that this media player supports.
Example:
var qtinfo = app.media.getPlayers().select({id: /quicktime/i })[0];
console.println( qtinfo.mimeTypes );
data-id=49721
data-id=id767
data-id=id768
name
The name of the media player. This string is localized according to the current language as found in app.language. It is suitable for display in list boxes and the like, but not for direct comparisons in JavaScript code.
data-id=24800
data-id=id769
data-id=id770
version
A string containing the version number of the media player. For most players, it is the version number of the underlying media player that is installed on the user’s system. This string is in dotted decimal format, for example, 7.4.030.1170.
data-id=playerinfo-methods
data-id=id771
PlayerInfo methods
data-id=76833
data-id=canplay
data-id=id772
canPlay
Checks to see if the media player can be used for playback, taking the user’s security settings into account.
If the parameter bRejectPlayerPrompt is true, the method returns false if using this player would result in a security prompt. Otherwise the method returns true if playback is allowed either with or without a security prompt. (This method itself never triggers a security prompt, but a later attempt to create a media player may.)
Parameters
oDocbRejectPlayerPromptfalse. If true, the method returns false if using this player would result in a security prompt. If false, the method returns true if playback is allowed either with or without a security prompt.Returns
Boolean
data-id=82266
data-id=canusedata
data-id=id773
canUseData
Tells whether the player can use the specified data, as passed by its parameter oData, for playback. Returns true if the data can be used for playback and false otherwise.
Parameters
oDataMediaSettings.data for a description of this object). This object is obtained in several ways, from app.media.getAltTextData, app.media.getURLData, or indirectly by Rendition.getPlaySettings.Returns
Boolean
data-id=54413
data-id=honors
data-id=id774
honors
Asks a player plug-in whether it can honor all of the settings, methods, and events listed in the args parameter. The answer is not guaranteed to be correct, but is a best guess without opening a media player. For example, if args.URL is provided, the scheme (such as "http://") is checked, but honors does not try to actually open the URL.
Note
Compatibility:
honorsis supported only on Acrobat 7.0 and above. The Acrobat SDK provides JavaScript source code that can be copied into a PDF to provide compatibility with both Acrobat 6.0 and Acrobat 7.0. This code uses hard-coded tests for Acrobat 6.0 and callshonorson newer versions of Acrobat. See the playerHonors Function for details.
honorsand the HonorsArgs object are similar to the MH (“must honor”) entries in the PDF format, some of which can be set in the Playback Requirements panel of the Rendition Settings for a multimedia rendition. Thehonorsmethod provides a way to choose a player that meets playback requirements dynamically in JavaScript code instead of statically in the PDF file.
Parameters
argsHonorsArgs object to be tested. The HonorsArgs object is very similar to the parameter, PlayerArgs Object, used by the app.media.openPlayer method. In fact, any PlayerArgs object can be used as an HonorsArgs. HonorsArgs also allows a few other options that are used only with honors.Returns
A Boolean value which is true if the player plug-in can honor everything in the args object.
data-id=26457
Example: Play a media clip using a player that supports specific features.
function playWithRequirements( args )
{
var plugins = app.media.getPlayers( args.mimeType )
if( plugins )
{
for (var plugin in plugins)
{
if( plugin.honors(args) )
{
args.players = [plugin];
return app.media.openPlayer( args );
}
}
}
}
Play using a media player that has these capabilities for an AVI file on an http URL: It can turn off autoplay, supports the pause method, the seek method and startAt setting using a marker+time offset, and supports the Ready and Close events.
playWithRequirements({
mimeType: 'video/avi',
URL: 'http://www.example.com/bar.avi',
settings:
{
autoPlay: false,
startAt: { marker: 'test', time: 1 },
},
methods:
{
pause:[],
seek[ { marker: 'test', time: 1 } ],
},
events:
{
afterReady: doAfterReady( e ),
onClose: doOnClose( e ),
},
});
data-id=90332
HonorsArgs object
The HonorsArgs object lists settings, methods, and events that are used in a call to the honors method of the PlayerInfo object or the playerHonors function. In this discussion, PlayerInfo.honors refers to both.
Any PlayersArgs object (as used in a call to app.media.openPlayer) may be used as an HonorsArgs object, or an HonorsArgs object can be created to be used in a PlayerInfo.honors call.
If the same object is used in app.media.openPlayer and PlayerInfo.honors, be aware that the two functions interpret unknown args differently. app.media.openPlayer ignores settings or events that it does not know about, but PlayerInfo.honors returns false if there are any settings, methods, or events it does not recognize.
For example, { settings: { upsideDown: true } } would be allowed in an app.media.openPlayer call. There is no such setting as “upsideDown”, so the setting is ignored. But in a call to PlayerInfo.honors, this unknown setting returns false.
Below is a complete list of the properties allowed in the HonorsArgs object. This illustration is loosely in the form of a JavaScript object literal, but it shows the type or description of each property instead of an actual property value:
args =
{
mimeType: string,
URL: string,
settings:
{
autoPlay: boolean,
baseURL: string,
bgColor: Acrobat color array,
duration: number,
endAt: MediaOffset,
layout: number,
palindrome: boolean,
rate: number,
repeat: number,
showUI: boolean,
startAt: MediaOffset,
visible: boolean,
volume: number,
},
methods:
{
pause: [],
play: [],
seek: [ MediaOffset ],
stop: [],
where: [],
},
events:
{
Done: anything, onDone: anything, afterDone: anything,
Error: anything, onError: anything, afterError: anything,
Escape: anything, onEscape: anything, afterEscape: anything,
Pause: anything, onPause: anything, afterPause: anything,
Play: anything, onPlay: anything, afterPlay: anything,
Ready: anything, onReady: anything, afterReady: anything,
Script: anything, onScript: anything, afterScript: anything,
Seek: anything, onSeek: anything, afterSeek: anything,
Status: anything, onStatus: anything, afterStatus: anything,
Stop: anything, onStop: anything, afterStop: anything,
},
}
Additional comments on the above listing.
- The
mimeType,URL, andsettingsproperties are identical to the corresponding properties in PlayerArgs. ThemimeTypeproperty is required; thehonorsmethod does not try to determine the MIME type from the URL’s file extension.URLcan be a real URL or a fictitious one, as long as it is in the correct URL format. See MediaSettings object for a description of these properties. - The
methodsproperty lists the MediaPlayer methods that the player must support for the given MIME type. The value of eachmethodsproperty is an array containing the arguments that would be passed into a call to that method. In Acrobat 7.0, the only player method that has any arguments isseek, which takes a single MediaOffset argument. See MediaPlayer object for a description of these properties.
If you use the same object as a PlayerArgs and an HonorsArgs, it can have a methods property, even though a PlayerArgs normally does not have that property. Anywhere a PlayerArgs is used, the unknown property is ignored.
- The
eventsproperty lists the events that the player must support. As shown above, each event can be named with theonorafterprefix or no prefix. All three mean the same thing. If a player supports a particular on event, it always supports the correspondingafterevent (because theafterevents are generated in the same way for all players). See EventListener object for a description of these properties.
The notation anything means literally that: in the HonorsArgs, these values are just placeholders. So, the events object from a PlayerArgs works in an HonorsArgs:
events:
{
afterReady: doAfterReady( e ),
onClose: doOnClose( e ),
},
Or, if you are creating an HonorsArgs, you can simplify the notation as follows:
events: { Ready: true, Close: true },
data-id=29870
playerHonors Function
This function is provided as JavaScript source code that can be copied into a PDF file as a document script. It performs the same tests as the honors method in Acrobat 7.0, but it works on Acrobat 6.0 as well.
When running on Acrobat 6.0, playerHonors uses hard-coded tests that match the capabilities of the media players shipped with Acrobat 6.0.
When running on Acrobat 7.0 and later, playerHonors calls honors.
Parameters
docinfoPlayerInfo object.argsHonorsArgs object to be tested.Returns
A Boolean value which is true if the player plug-in can honor everything in the args object.
Example: This example is the same as shown for the honors method of the PlayerInfo object, but using the playerHonors JavaScript function. This works on both Acrobat 6.0 and 7.0, provided a copy of the playerHonors source code is placed into the target PDF.
function playWithRequirements( args ) {
var plugins = app.media.getPlayers( 'video/avi' )
if( plugins ) {
for (var plugin in plugins) {
if( playerHonors( doc, plugin, args ) ) {
args.players = [plugin];
return app.media.openPlayer( args );
}
}
}
}
data-id=14162
data-id=playerinfolist
data-id=id775
PlayerInfoList
This object is equivalent to an array of PlayerInfo objects. The individual elements (the PlayerInfo objects) can be accessed using the usual array notation. The number of elements can be obtained from the length property.
This object is returned by the app.media.getPlayers method.
When a media player is created using app.media.createPlayer, the settings.players property of the PlayerArgs object passed to the method may contain a PlayerInfoList. The created player is restricted to those in the list.
data-id=playerinfolist-methods
data-id=id776
PlayerInfoList methods
data-id=59419
data-id=id777
data-id=id778
select
Returns a copy of the PlayerInfoList, filtered to include only the players that match selection criteria. If no players match, an empty array is returned.
Parameters
objectid, name, or version. The values of these properties may be strings or regular expressions. Specified properties are required to match. Omitted properties can match any player.Returns
PlayerInfoList object
Example 1: Use QuickTime to view the media clip.
var playerList = app.media.getPlayers().select({ id: /quicktime/i });
// QuickTime supports palindrome, so let's try it.
var settings = { players: playerList, palindrome: true };
var player = app.media.openPlayer({ settings: settings });
Example 2: Choose the Flash player by using a pattern match on its player ID.
var player = app.media.createPlayer();
player.settings.players = app.media.getPlayers().select({ id:/flash/i});
player.open();
data-id=48754
data-id=plugin
data-id=id779
PlugIn
This object gives access to information about the plug-in it represents. A PlugIn object is obtained using app.plugIns.
data-id=plugin-properties
data-id=id780
PlugIn properties
data-id=41150
data-id=certified
data-id=id781
certified
If true, the plug-in is certified by Adobe. Certified plug-ins have undergone extensive testing to ensure that breaches in application and document security do not occur. The user can configure the viewer to only load certified plug-ins.
Example: Get the number of uncertified plug-ins.
var j=0; aPlugins = app.plugIns;
for (var i=0; i < aPlugins.length; i++)
if (!aPlugins[i].certified) j++;
console.println("Report: There are "+j+" uncertified plug-ins loaded.");
data-id=99810
data-id=loaded
data-id=id782
loaded
If true, the plug-in was loaded.
data-id=25279
data-id=id783
data-id=id784
name
The name of the plug-in.
Example: Get the number of plug-ins, and list them in the console.
// Get an array of PlugIn Objects
var aPlugins = app.plugIns;
// Get the number of plug-ins
var nPlugins = aPlugins.length;
// Enumerate the names of all plug-ins
for (var i = 0; i < nPlugins; i++)
console.println("Plugin #" + i + " is " + aPlugins[i].name);
data-id=94716
data-id=id785
data-id=id786
path
The device-independent path to the plug-in.
data-id=92542
data-id=id787
data-id=id788
version
The version number of the plug-in. The integer part of the version number indicates the major version, and the decimal part indicates the minor and update versions. For example, 5.11 would indicate that the plug-in has major version 5, minor version 1, and update version 1.
data-id=43354
data-id=printparams
data-id=id789
PrintParams
This is a generic object that controls printing parameters that affect any document printed using JavaScript. Changing this object does not change the user preferences or make any permanent changes to the document.
In Acrobat 6.0, the Doc print method takes a PrintParams object as its argument. You can obtain a PrintParams object from the Doc getPrintParams method. The returned object can then be modified.
Many of the PrintParams properties take integer constants as values, which you can access using the constants property. For example:
// Get the printParams object of the default printer
var pp = this.getPrintParams();
// Set some properties
pp.interactive = pp.constants.interactionLevel.automatic;
// Print
this.print(pp);
The constants properties are all integers allowing read access only.
data-id=printparams-properties
data-id=id790
PrintParams properties
data-id=39494
data-id=binaryok
data-id=id791
binaryOK
true if a binary channel to the printer is supported. The default is true.
data-id=72759
data-id=bitmapdpi
data-id=id792
bitmapDPI
The dots per inch (DPI) to use when producing bitmaps or rasterizing transparency. The valid range is 1 to 9600. If the document protections specify a maximum printing resolution, the lower of the two values is used. The default is 300. Illegal values are treated as 300. See also gradientDPI.
data-id=75229
data-id=booklet
data-id=id793
booklet
An object used to set the parameters for booklet printing. The properties of the booklet object are listed in the table below.
bindingbinding property determines the paper binding direction and the page arrange order. The value of binding is set through the constants bookletBindings object, given below. The default is Left.duplexModeduplexMode property determines the duplex printing mode. The value of duplexMode property is set through the constants duplexMode object, given below. The default is BothSides. When the output device doesn’t support automatic duplex functionality, a manual duplex can be performed by two separated printings of front and back sides.subsetFromsubsetFrom determines the first booklet sheet to be printed. Independently from the general page range selection, only a subset of the final booklet result is printed by this option. Valid sheet numbers start from 0, which is the first sheet. The default value is 0. The special value of -1 represents the last sheet. More generally, the negative integer -N represents the sheet that is (N-1) from the last sheet. Thus, -2 is the sheet just before the last sheet, -3 is the sheet that is 2 sheets from the last one. See the additional note below on booklet subsetting.subsetTosubsetTo determines the last booklet sheet to be printed. Independently from the general page range selection, only a subset of the final booklet result is printed by this option. Valid sheet numbers start from 0, but the value -1 represents the last sheet. The default value is -1. The negative integer -N represents the sheet that is (N-1) from the last sheet. Thus, -2 is the sheet just before the last sheet, -3 is the sheet that is 2 sheets from the last one. See the additional note below on booklet subsetting.The bookletBindings object has properties used to set the value of booklet.binding.
constants.bookletBindings object
LeftRightLeftTallRightTallThe bookletDuplexModes object has properties used to set the value of booklet.duplexMode.
data-id=53154
constants.bookletDuplexModes object
BothSidesFrontSideOnlyBacksideOnly mode to complete a manual duplex printing.BackSideOnlyNote
(Booklet subsetting using
subsetFromandsubsetTo) Since the booklet output can change by the source page range (by setting firstPage and lastPage properties of the PrintParams object), the same effect cannot be achieved easily by changing these page range properties. For example. the first (2-side) sheet of an 8-page booklet job has a page number sequence of [8, 1, 2, 7] while the first sheet of 16-page booklet job has a page number sequence of [16, 1, 2, 15]. ThesubsetFromandsubsetToproperties are useful for printing certain pages of a booklet document with different devices or media. A typical example would be printing the cover and the inside cover in color while rest of the document is in black and white. Another common example is printing the cover page on thicker colored paper.
Example 1 (binding)
Set up booklet printing for right-side binding of text, and print.
var pp = this.getPrintParams();
pp.pageHandling = pp.constants.handling.booklet;
pp.booklet.binding = pp.constants.bookletBindings.Right;
this.print(pp);
Example 2 (duplexMode)
Print booklet in duplex mode, printing only the front pages.
var pp = this.getPrintParams();
pp.pageHandling = pp.constants.handling.booklet;
pp.booklet.duplexMode = pp.constants.bookletDuplexModes.FrontSideOnly;
this.print(pp);
Example 3 (subsetFrom and subsetTo)
Set up booklet printing to print the second sheet only and print.
var pp = this.getPrintParams();
pp.pageHandling = pp.constants.handling.booklet;
pp.booklet.subsetFrom = 1;
pp.booklet.subsetTo = 1;
this.print(pp);
Set booklet printing from the second sheet to the last sheet.
pp.booklet.subsetFrom = 1;
pp.booklet.subsetTo = -1;
Set booklet printing to print last sheet only.
pp.booklet.subsetFrom = -1;
pp.booklet.subsetTo = -1;
Set booklet printing to print last sheet two sheets.
pp.booklet.subsetFrom = -2;
pp.booklet.subsetTo = -1;
Set booklet printing to print all pages except the last two.
pp.booklet.subsetFrom = 0;
pp.booklet.subsetTo = -3;
data-id=78256
data-id=colorprofile
data-id=id794
colorProfile
The color profile to use. A list of available color spaces can be obtained from printColorProfiles. The default is “Printer/PostScript Color Management”.
data-id=12065
data-id=id795
data-id=id796
constants
Each instance of a PrintParams object inherits this property, which is a wrapper that holds various constant values. The values are all integers allowing read access only. They are used as option values of some of the other properties of the PrintParams object, and their values are listed with the properties to which they apply.
bookletBindingsbookletDuplexModesduplexTypesfontPolicieshandlinginteractionLevelnUpPageOrdersprintContentsflagValuesrasterFlagValuessubsetstileMarksusagesdata-id=57970
data-id=downloadfareastfonts
data-id=id797
downloadFarEastFonts
If true (the default), send Far East fonts to the printer if needed. Set this property to false if the printer has Far East fonts but incorrectly reports that it needs them.
data-id=24870
data-id=duplextype
data-id=id798
DuplexType
Sets the printing duplex mode to simplex, duplex long edge, or duplex short edge feed. This property appears as DuplexMode under the Advanced tab of the Document Properties dialog box.
constants.duplexTypes Object
The duplex options are accessed through the constants.duplexType object. The properties of this object are listed in the table that follows.
The selected printer should support duplex printing, if either DuplexFlipLongEdge or DuplexFlipShortEdge is used.
Example: Set printing to duplex short edge feed and print.
var pp = this.getPrintParams();
pp.DuplexType = pp.constants.duplexTypes.DuplexFlipShortEdge;
this.print(pp);
data-id=22668
data-id=id799
data-id=id800
fileName
The device-independent path for a file name to be used instead of sending the print job to the printer (Print to File). The path may be relative to the location of the current document. When printing to a file, if the interaction level (see interactive) is set to full, it is lowered to automatic.
The default value is the empty string (no file name).
Note
Printing to a file produces output suitable for the printer, for example, Postscript or GDI commands.
When printerName is an empty string and fileName is specified, the current document is saved as a PostScript file.
Example:
var pp = this.getPrintParams();
pp.fileName = "/c/print/myDoc.prn";
this.print(pp);
Example 2: Save the current document as a PostScript file.
var pp = this.getPrintParams();
pp.fileName = "/c/temp/myDoc.ps";
pp.printerName = "";
this.print(pp);
data-id=95550
data-id=firstpage
data-id=id801
firstPage
The first page number of the document to print. The number is 0-based. The first page of any document is 0, regardless of page number labels. The default value is 0, and values that are out of the document’s page range are treated as 0.
See also lastPage.
Example:
var pp = this.getPrintParams();
pp.firstPage = 0;
pp.lastPage = 9;
this.print(pp);
data-id=37069
data-id=flags
data-id=id802
flags
A bit field of flags to control printing. These flags can be set or cleared using bitwise operations through the constants flagValues object.
Zero or more flags can be set; unsupported flags are ignored. The flags default to those set by user preferences.
constants.flagValues object
The table below lists the properties of the flagValues object; unless otherwise noted, these properties are not available in Adobe Reader.
applyOverPrintapplySoftProofSettingsapplyWorkingColorSpacesemitHalftonesemitPostScriptXObjectsemitFormsAsPSFormsmaxJP2KRessetPageSizesuppressBGsuppressCentersuppressCJKFontSubstkAVEmitFontAllFonts is used.suppressCropClipsuppressRotatesuppressTransfersuppressUCRuseTrapAnnotsusePrintersMarksExample 1: In the Output options section of the Advanced Print Setup dialog box, check the Apply Output Preview Settings check box.
pp = getPrintParams();
fv = pp.constants.flagValues;
// or pp.flags = fv.applySoftProofSettings;;
pp.flags = pp.flags fv.applySoftProofSettings;
this.print(pp);
Example 2: Uncheck Auto-Rotate and Center (checked by default) in the Print dialog box.
pp = getPrintParams();
fv = pp.constants.flagValues;
pp.flags = (fv.suppressCenter fv.suppressRotate);
this.print(pp);
Example 3: In the PostScript options section of the Advanced Print Setup dialog box, check the Emit Undercolor Removal/Black Generation check box.
pp = getPrintParams();
fv = pp.constants.flagValues;
pp.flags &= ~(fv.suppressBG fv.suppressUCR)
this.print(pp)
data-id=11931
data-id=fontpolicy
data-id=id803
fontPolicy
Sets the font policy. The value of the fontpolicy property is set through the constants fontPolicies object. The default is pageRange.
constants.fontPolicies object
everyPagejobStartpageRangepageRange can be a good compromise between speed and memory. However, do not use it if the PostScriptcript pages will be programmatically reordered afterwards.data-id=64020
data-id=gradientdpi
data-id=id804
gradientDPI
The dots per inch to use when rasterizing gradients. This value can generally be set lower than bitmapDPI because it affects areas to which the eye is less sensitive. It must be set from 1 to 9600. Illegal values are treated as 150. If the document protections specify a maximum printing resolution, the lower of the two values will be used. The default value is 150.
data-id=91914
data-id=interactive
data-id=id805
interactive
Specifies the level of interaction between the user and the print job. The value of this property is set through the constants interactionLevel object. The default is full.
Note
(Acrobat 7.0) Non-interactive printing can only be executed during batch, console, and menu events. Printing is made non-interactive by setting
bUItofalsewhen calling the Docinteractiveproperty tosilent, for example,
var pp = this.getPrintParams();
pp.interactive = pp.constants.interactionLevel.silent;
Outside of batch, console, and menu events, the values of bUI and of interactive are ignored, and a print dialog box will always be presented.
See also priv.
constants.interactionLevel Object
automaticfullsilentExample:
var pp = this.getPrintParams();
pp.interactive = pp.constants.interactionLevel.automatic;
pp.printerName = "Adobe PDF";
this.print(pp);
data-id=49783
data-id=lastpage
data-id=id806
lastPage
The last 0-based page number of the document to print. The term “0-based” means the first page of any document is 0, regardless of page number labels. If the value is less than firstPage or outside the legal range of the document, this reverts to the default value. The default value is the number of pages in the document less one.
See firstPage for an example.
data-id=87255
data-id=nupautorotate
data-id=id807
nUpAutoRotate
A Boolean value that if true, automatically rotates each page to match the page orientation to the available paper area during Multiple Pages Per Sheet printing. The default is false, but nUpAutoRotate obeys the print settings.
Multiple Pages Per Sheet is obtained by setting pageHandling to nUp.
data-id=90256
data-id=nupnumpagesh
data-id=id808
nUpNumPagesH
The number of pages to lay out in the horizontal direction when printing Multiple Pages Per Sheet. The default is 2, but nUpNumPagesH obeys the print settings.
Multiple Pages Per Sheet is obtained by setting pageHandling to nUp.
Example: Perform Multiple Pages Per Sheet printing on this document, set up parameters, and print.
pp = this.getPrintParams();
pp.pageHandling = pp.constants.handling.nUp;
pp.nUpPageOrders = pp.constants.nUpPageOrders.Vertical;
pp.nUpNumPagesH = 3;
pp.nUpNumPagesV = 3;
pp.nUpPageBorder=true;
pp.nUpAutoRotate=true;
this.print(pp);
data-id=27311
data-id=nupnumpagesv
data-id=id809
nUpNumPagesV
The number of pages to be laid out in the vertical direction when printing Multiple Pages Per Sheet. The default is 2, but nUpNumPagesV obeys the print settings.
Multiple Pages Per Sheet is obtained by setting pageHandling to nUp.
See nUpNumPagesH for an example.
data-id=90998
data-id=nuppageborder
data-id=id810
nUpPageBorder
A Boolean value that if true, draws and prints a page boundary around each of the pages during Multiple Pages Per Sheet printing. The default is false, but nUpPageBorder obeys the print settings.
Multiple Pages Per Sheet is obtained by setting pageHandling to nUp.
See nUpNumPagesH for an example.
data-id=93690
data-id=nuppageorder
data-id=id811
nUpPageOrder
When printing multiple pages per sheet, the nUpPageOrder property determines how the multiple pages are laid out on the sheet. The value of the nUpPageOrder property is set through the constants nUpPageOrders object. The default is Horizontal, but nUpPageOrder obeys the print settings.
Multiple Pages Per Sheet is obtained by setting pageHandling to nUp.
constants.nUpPageOrders Object
HorizontalHorizontalReversedVerticalExample: Perform Multiple Pages Per Sheet printing on this document, set the parameters, and print.
pp = this.getPrintParams();
pp.pageHandling = pp.constants.handling.nUp;
pp.nUpPageOrders = pp.constants.nUpPageOrders.Horizontal;
pp.nUpNumPagesH = 2;
pp.nUpNumPagesV = 2;
pp.nUpPageBorder=true;
this.print(pp);
data-id=58768
data-id=numcopies
data-id=id812
NumCopies
Sets the number of copies to be printed for this print job.
Example: Set print job for duplex printing with two copies.
var pp = this.getPrintParams();
pp.DuplexType = pp.constants.duplexTypes.DuplexFlipShortEdge;
pp.NumCopies = 2;
this.print(pp);
data-id=89810
data-id=pagehandling
data-id=id813
pageHandling
Takes one of seven values specified by the constants handling object. If set to an illegal value, it is treated as shrink. The default is shrink.
constants.handling Object
nonefitshrinktileAlltileScale property greater than 1.tileLargenUpbookletExample 1:
var pp = this.getPrintParams();
pp.pageHandling = pp.constants.handling.shrink;
this.print(pp);
Example 2: Perform Multiple Pages Per Sheet printing on this document, set the parameters and print.
pp = this.getPrintParams();
pp.pageHandling = pp.constants.handling.nUp;
pp.nUpPageOrders = pp.constants.nUpPageOrders.Horizontal;
pp.nUpNumPagesH = 2;
pp.nUpNumPagesV = 2;
pp.nUpPageBorder=true;
this.print(pp);
Example 3 (Version 8.0)
Print document as a booklet, taking all the default settings.
var pp = this.getPrintParams();
pp.pageHandling = pp.constants.handling.booklet;
this.print(pp);
data-id=51148
data-id=pagesubset
data-id=id814
pageSubset
Select even, odd, or all the pages to print. The value of pageSubset is set through the constants subsets object. The default is all.
constants.subsets Object
allevenoddExample:
var pp = this.getPrintParams();
pp.pageSubset = pp.constants.subsets.even;
this.print(pp);
data-id=72914
data-id=printasimage
data-id=id815
printAsImage
Set to true to send pages as large bitmaps. This can be slow and more jagged looking but can work around problems with a printer’s PostScript interpreter. Set bitmapDPI to increase or decrease the resolution of the bitmap. If interaction (see interactive) is full, the user’s printer preferences for printAsImage will be used. The default is false.
data-id=95227
data-id=printcontent
data-id=id816
printContent
Sets the contents of the print job. The value of the printContents property is set through the constants printContents object. The default is doc.
constants.printContents Object
docdocAndCommentsformFieldsOnlyExample: Set printer to silently print form fields only.
var pp = this.getPrintParams();
pp.interactive = pp.constants.interactionLevel.silent;
pp.printContent = pp.constants.printContents.formFieldsOnly;
this.print(pp);
data-id=84668
data-id=printrange
data-id=id817
printRange
Use the printRange property to print multiple sets of pages, each having a different page range. The parameter format is an array of pairs (nStart, nEnd), where nStart and nEnd are 0-based index pages of the PDF document.
Exceptions
The ESErrorInvalidArgs exception occurs when:
- the format of the specified parameters is invalid
- the
startPageandendPagevalues are less than 0. - the
startPageandendPagevalues are greater than or equal tototalPagesin the PDF.
Example 1:
var pp = this.getPrintParams();
pp.interactive = pp.constants.interactionLevel.full;
pp.printRange=[[1, 1], [3, 4]];
this.print(pp);
data-id=92611
data-id=printername
data-id=id818
printerName
The name of the destination printer. This property is a Windows and, beginning with version 9.0, a Mac OS feature.
By default, printerName is set to the name of the default printer. If printerName is set to an empty string, the printer used is either the last printer used by Acrobat/Adobe Reader (if printing occurred during the current session) or the System Default printer. When printerName is an empty string and fileName is a nonempty string, the current document is saved as a PostScript file. See example 2 below.
See also app. printerNames.
Example 1: Set the printer, and print.
var pp = this.getPrintParams();
pp.printerName = "hp officejet d series";
this.print(pp);
data-id=89060
Example 2: Save the current document as a PostScript file.
var pp = this.getPrintParams();
pp.fileName = "/c/temp/myDoc.ps";
pp.printerName = "";
this.print(pp);
data-id=86941
data-id=pslevel
data-id=id819
psLevel
Level of PostScript that is emitted to PostScript printers. Level 0 indicates to use the PostScript level of the printer. Level 1 is not supported. In addition to 0, current legal values of psLevel are 2 and 3. If the printer only supports PostScript level 1, printAsImage is set to true. Illegal values are treated as 3. The default value for psLevel is 3.
data-id=25286
data-id=rasterflags
data-id=id820
rasterFlags
A bit field of flags. These flags can be set or cleared using bitwise operations through the constants rasterFlagValues object. The default is set by user preferences.
constants.rasterFlagValues Object
The table that follows lists the properties of the rasterFlagValues object. None of these properties are available in Adobe Reader.
textToOutlinestrokesToOutlineallowComplexClippreserveOverprintExample 1: In the Advanced Printing Setup dialog box, check the “Convert All Text to Outlines” check box in the Transparency Flattening option.
pp = getPrintParams();
rf = pp.constants.rasterFlagValues;
pp.rasterFlags = rf.textToOutline;
this.print(pp);
data-id=62217
Example 2: In the Advanced Printing Setup dialog box, uncheck “Complex Clip Regions” (checked by default) in the Transparency Flattening option.
pp = getPrintParams();
rf = pp.constants.rasterFlagValues;
pp.rasterFlags = pp.rasterFlags & ~rf.allowComplexClip;
// or pp.rasterFlags &= ~rf.allowComplexClip;
this.print(pp);
data-id=54392
data-id=reversepages
data-id=id821
reversePages
Set to true to print pages in reverse order (last to first). The default value is false.
data-id=27667
data-id=tilelabel
data-id=id822
tileLabel
Label each page of tiled output. Labeled pages indicate row and column, file name, and print date. The default is false.
data-id=94282
data-id=tilemark
data-id=id823
tileMark
Tile marks indicate where to cut the page and where overlap occurs. The value is set through the constants tileMarks object. If set to an illegal value, it is treated as none. The default is none.
constants.tileMarks Object
nonewesteastdata-id=73551
data-id=tileoverlap
data-id=id824
tileOverlap
The number of points that tiled pages have in common. Value must be between 0 and 144. Illegal values are treated as 0. The default value is 0.
data-id=75324
data-id=tilescale
data-id=id825
tileScale
The amount that tiled pages are scaled. Pages that are not tiled are unaffected by this value. The default is unscaled (1.0). Larger values increase the size of the printout (for example, 2.0 is twice as large, a value of 0.5 is half as large). The value of tileScale must be between 0.01 and 99.99. Illegal values are treated as 1.0, which is the default value.
data-id=88218
data-id=transparencylevel
data-id=id826
transparencyLevel
An integer value from 1 to 100 indicates how hard Acrobat tries to preserve high-level drawing operators. A value of 1 indicates complete rasterization of the image, which results in poor image quality but high speeds. A value of 100 indicates as much should be preserved as possible, but can result in slow print speeds. If set to an illegal value, 75 is used. When rasterizing, the bitmapDPI and gradientDPI values are used. The default value is 75.
data-id=15187
data-id=useprintercrd
data-id=id827
usePrinterCRD
Takes one of three values. The value is set through the constants usages object. See also useT1Conversion; the two properties use the same values, but the interpretations are different.
constants.usages Object
autoauto. The default is auto.usenoUsedata-id=62958
data-id=uset1conversion
data-id=id828
useT1Conversion
Takes one of three values. The value of the useT1Conversion property is set through the constants usages object. See also usePrinterCRD; the two properties use the same values, but the interpretations are different.
Note
This property is supported on Windows platforms only.
This property uses the constants.usages Object values as follows.
autoauto. The default is auto.usenoUsedata-id=79704
data-id=rdn
data-id=id829
RDN
This generic object represents a Relative Distinguished Name. It is used by securityHandler. newUser and the certificate. issuerDN and subjectCN properties.
It has the following properties.
businessCategoryccncountryOfCitizenshipcountryOfResidencedateOfBirthnewUser)dcdnQualifiergendergenerationQualifiergivenNameinitialslnamenameAtBirthoouplaceOfBirthpostalAddressnewUser)postalCodepseudonymserialNumbersnststreettitledata-id=32813
data-id=readstream
data-id=id830
ReadStream
A ReadStream object is an object literal that represents a stream of data. It contains a method to allow reading the data stream.
readnBytesdata-id=47886
data-id=rendition
data-id=id831
Rendition
A Rendition contains information needed to play a media clip, including embedded media data (or a URL) and playback settings. It corresponds to a Rendition in the Acrobat authoring user interface.
A Rendition is a base type for either a MediaRendition or a MediaSelector. A function that accepts a Rendition can take either of these two types. The properties and methods described in this section are available for both MediaRendition and MediaSelector. Use the type property to distinguish between MediaRendition and MediaSelector.
data-id=rendition-properties
data-id=id832
Rendition properties
data-id=57156
data-id=alttext
data-id=id833
altText
The alternate text string for the rendition (an empty string if no alternate text was specified). This property is available only if the type of the rendition is app.media.renditionType.media (a MediaRendition).
Example: Get the altText of a rendition.
this.media.getRendition("myClip").altText;
See the examples that follow app.media. getAltTextSettings.
data-id=26757
data-id=id834
data-id=id835
doc
A reference to the document that contains the Rendition.
data-id=94327
data-id=id836
data-id=id837
fileName
If the media is embedded, this property returns an empty string. Otherwise it returns the file name or URL of the media. This property is available only if the type of the rendition is app.media.renditionType.media.
data-id=69594
data-id=id838
data-id=id839
type
An app.media.renditionType value indicating the type of rendition.
Currently, there are two types: MediaRendition and RenditionList:
- When
Rendition.typeis equal toapp.media.renditionType.media, the Rendition is a MediaRendition. A MediaRendition is an individual Rendition, as it appears in the Settings tab of the Multimedia Properties dialog box. - When
Rendition.typeis equal toapp.media.renditionType.selector, the Rendition is a RenditionList. A RenditionList is an array of MediaRendition. The list is the one that appears in the Settings tab of the Multimedia Properties dialog box.
Future versions of Acrobat may add more renditionType values, so JavaScript code should not assume that only the existing app.media.renditionType values may be encountered.
data-id=97659
data-id=id840
data-id=id841
uiName
The name of the Rendition, as found in the N entry in its dictionary in the PDF file.
Example: The following is executed as a Rendition action.
console.println("Preparing to play ""
+ event.action.rendition.uiName + """);
See the event object for a description of event.action.rendition.
data-id=rendition-methods
data-id=id842
Rendition methods
data-id=15194
data-id=getplaysettings
data-id=id843
getPlaySettings
Creates and returns a MediaSettings object that can be used to create a MediaPlayer object.
This method is available only for a MediaRendition.
Parameters
bGetDatatrue, the MediaSettings object returns the MediaData (See MediaSettings. data).Returns
A MediaSettings object
Note
app.media.getAltTextSettingscallsgetPlaySettings(false)to obtain the correct settings to display alternate text.
This MediaSettings object includes these properties:
autoPlaybaseURL(if specified inrendition)bgColorbgOpacitydata(ifbGetDatais true)durationendAtlayoutmonitorTypepalindromeshowUIraterepeatstartAtvisiblevolumewindowType
In the current version of Acrobat, all of these properties are present in the settings object (except as noted above). null is used when values such as startAt are unspecified. This may change in the future to return only those values that are actually specified, with defaults assumed for the rest.
Example:
// Get the MediaSettings for this Rendition
var settings = myRendition.getPlaySettings();
if( settings.startAt !== null ) // Do NOT use this strict comparison!
...
if( settings.startAt ) // This is OK
...
See app.media. getAltTextSettings and app.media. openPlayer for examples of usage.
data-id=80973
data-id=id844
data-id=id845
select
Selects a media player to play a MediaRendition or a RenditionSelector. If the Rendition is a RenditionSelector, select examines every MediaRendition contained within and selects the most suitable one. (See type for a description of RenditionSelector and MediaRendition.)
The return value is a MediaSelection object that can be used to create a MediaSettings object. This object can then be used to create a MediaPlayer object.
Parameters
bWantRejectsbWantRejects is true, the rejects property of the resulting MediaSelection will contain information about media players that were rejected during the selection process.oContextoContext is a MediaSelection.selectContext value from a previous Rendition.select call. This parameter allows you to write a loop that calls Rendition.select repeatedly until you find a media player that satisfies any selection criteria that you want to test in JavaScript code.Returns
A MediaSelection object
Example 1: Get a usable MediaSelection for this Rendition.
var selection = rendition.select();
data-id=50647
Example 2: Get the name of the selected rendition. This script is executed from a Rendition action event.
var selection = event.action.rendition.select();
console.println( "Preparing to play " + selection.rendition.uiName);
data-id=90781
data-id=testcriteria
data-id=id846
testCriteria
Tests the Rendition against any criteria that are specified in the PDF file, such as minimum bandwidth, and returns a Boolean value indicating whether the Rendition satisfied all of those criteria.
Returns
Boolean
data-id=62908
data-id=report
data-id=id847
Report
The Report object allows the user to programmatically generate PDF documents suitable for reporting with JavaScript. Use the writeText constructor to create a Report object; for example,
var rep = new Report();
The properties and methods can then be used to write and format a report.
data-id=report-properties
data-id=id848
Report properties
data-id=47833
data-id=absindent
data-id=id849
absIndent
Controls the absolute indentation level. It is desirable to use the indent and outdent methods whenever possible, because they correctly handle indentation overflows.
If a report is indented past the middle of the page, the effective indent is set to the middle. Note that divide indicates that it has been indented too far.
data-id=95175
data-id=id850
data-id=id851
color
Controls the color of any text and any divisions written into the report.
Text is written to the report with writeText and divisions (horizontal rules) are written using divide.
Example:
var rep = new Report();
rep.size = 1.2;
rep.color = color.blue;
rep.writeText("Hello World!");
data-id=16633
data-id=id852
data-id=id853
size
Controls the size of any text created by writeText It is a multiplier. Text size is determined by multiplying the size property by the default size for the given style.
Example: Write a “Hello World!” document.
var rep = new Report();
rep.size = 1.2;
rep.writeText("Hello World!");
data-id=50854
data-id=id854
data-id=id855
style
This property controls the style of the text font for the text created by writeText. Values of style are:
DefaultNoteText
NoteTitle
Example: Start a new report, set font size, write short text and open report.
var rep = new Report();
rep.size = 1.2;
rep.style = "DefaultNoteText";
rep.writeText("Hello World!");
rep.open("My Report");
data-id=report-methods
data-id=id856
Report methods
data-id=45222
data-id=breakpage
data-id=id857
breakPage
Ends the current page and begins a new one.
data-id=79384
data-id=divide
data-id=id858
divide
Writes a horizontal rule across the page at the current location with the given width. The rule goes from the current indent level to the rightmost edge of the bounding box. If the indent level is past the middle of the bounding box, the rule shows this.
Parameters
nWidthdata-id=76312
data-id=indent
data-id=id859
indent
Increments the current indentation mark by nPoints or the default amount. If a report is indented past the middle of the page, the effective indent is set to the middle. Note that divide makes a mark to indicate whether it has been indented too far.
See writeText for an example of usage.
Parameters
nPointsdata-id=52175
data-id=id860
data-id=id861
Ends report generation and mails the report.
See also mailGetAddrs, app. mailMsg, the Doc mailForm method, and the FDF object mail method.
Parameters
bUItrue (the default), the rest of the parameters are used to seed the compose-new-message window that is displayed to the user. If false, the cTo parameter is required and all others are optional. - (Acrobat 7.0) When this method is executed in a non-privileged context, the bUI parameter is not honored and defaults to true. See priv.cTocCccBcccSubjectcMsgdata-id=10871
data-id=id862
data-id=id863
open
Ends report generation, opens the report in Acrobat and returns a Doc that can be used to perform additional processing of the report.
Parameters
cTitleReturns
A Doc.
Example: Open a report, get the Doc, and set some properties of the document.
var docRep = rep.open("myreport.pdf");
docRep.info.Title = "End of the month report: August 2000";
docRep.info.Subject = "Summary of comments at the August meeting";
See writeText for a more complete example.
data-id=12120
data-id=outdent
data-id=id864
outdent
The opposite of indent; that is, decrements the current indentation mark by nPoints or the default amount.
See writeText for an example of usage.
Parameters
nPointsdata-id=14001
data-id=id865
data-id=id866
Report
A constructor. Creates a new Report object with the given media and bounding boxes (values are defined in points or 1/72 of an inch). Defaults to a 8.5 x 11 inch media box and a bounding box that is indented 0.5 inches on all sides from the media box.
Parameters
aMediaaBBoxReturns
A Report object.
data-id=55306
data-id=id867
data-id=id868
save
Ends report generation and saves the report to the specified path.
Note
This method can only be executed during a batch or console event. See priv. The event object contains a discussion of JavaScript events.
Parameters
cDIPathcFScFS is “CHTTP”. In this case, the cDIPath parameter should be an URL. This parameter is only relevant if the web server supports WebDAV.Example 1:
rep.save("/c/myReports/myreport.pdf");
Example 2:
rep.save({
cDIPath: "http://www.example.com/reports/WebDAV/myreport.pdf",
cFS:"CHTTP"}
);
data-id=30283
data-id=writetext
data-id=id869
writeText
Writes out a block of text to the report. Every call begins on a new line at the current indentation mark. Correctly wraps Roman, CJK, and WGL4 text.
Parameters
StringExample:
// Get the comments in this document, and sort by author
this.syncAnnotScan();
annots = this.getAnnots({nSortBy: ANSB_Author});
// Open a new report
var rep = new Report();
rep.size = 1.2;
rep.color = color.blue;
if (annots) {
rep.writeText("Summary of Comments: By Author");
rep.color = color.black;
rep.writeText(" ");
rep.writeText("Number of Comments: " + annots.length);
rep.writeText(" ");
var msg = "200 page %s: "%s"";
var theAuthor = annots[0].author;
rep.writeText(theAuthor);
rep.indent(20);
for (var i=0; i < annots.length; i++) {
if (theAuthor != annots[i].author) {
theAuthor = annots[i].author;
rep.writeText(" ");
rep.outdent(20);
rep.writeText(theAuthor);
rep.indent(20);
}
rep.writeText(
util.printf(msg, 1 + annots[i].page, annots[i].contents));
}
} else {
var msg = "No annotations found in this document, %s.";
rep.writeText(util.printf(msg, this.documentFileName));
}
// Now open the report
var docRep = rep.open("myreport.pdf");
docRep.info.Title = "End of the month report: August 2006";
docRep.info.Subject = "Summary of comments at the August meeting";
data-id=66963
data-id=row
data-id=id870
Row
This generic JavaScript object contains the data from every column in a row. It is returned by the Statement object method. It contains the following properties:
columnArrayColumn objects. It is equivalent to what the Statement object method would return if called on the same Statement object at the same time that this row object was created.data-id=43548
data-id=screenannot
data-id=id871
ScreenAnnot
A ScreenAnnot object represents a screen annotation, which is a rectangular area within a PDF document viewed on the display screen. A ScreenAnnot may have Renditions and RenditionActions associated with it for multimedia playback.
Note
The ScreenAnnot object is part of the Acrobat 6.0 (and Later) Compatible Media JavaScript API. Multimedia assets that use this approach rely on the underlying operating system to locate and launch a multimedia player residing on the user’s system. Acrobat 9.0 (and Later) natively supports Flash video (FLV) and Flash applications (SWF) which can be embedded in, or streamed to, a PDF document. Native support for Flash enables reliable cross-platform playback. No additional media player or specific codec is necessary.
Acrobat 6.0 (and Later) Compatible Media is superseded by the multimedia of Acrobat 9.0 (and Later), which uses rich media annotations. Developers of PDFs with multimedia assets are, therefore, strongly encouraged to use the rich media annotations of Acrobat 9 (and Later). Refer to the AnnotRichMedia object for JavaScript support for rich media annotations.
data-id=screenannot-properties
data-id=id872
ScreenAnnot properties
data-id=36955
data-id=id873
data-id=id874
altText
The alternate text string for the annotation (an empty string if no alternate text was specified).
Example: Get an annotation and write its altText to the debug console.
var annot = this.media.getAnnot({ nPage:0, cAnnotTitle: "myScreen" });
console.println( "annot.altText = " + annot.altText );
data-id=93566
data-id=alwaysshowfocus
data-id=id875
alwaysShowFocus
Normally, a screen annotation shows and hides a focus rectangle to indicate whether it has the keyboard focus. If this property is true, the focus rectangle is displayed by the screen annotation even if it does not have the focus. This is used for docked media playback, so that the focus rectangle of the annotation can remain visible even though the media player actually has the keyboard focus.
This property is not saved in the PDF file. If you change it, the change affects the current session only.
data-id=63528
data-id=id876
data-id=id877
display
Same as the Field object display property.
This property is not saved in the PDF file. If you change it, the change affects the current session only.
Example: Hide the annotation.
var annot = this.media.getAnnot({ nPage:0, cAnnotTitle: "myScreen" });
annot.display = display.hidden;
data-id=64999
data-id=id878
data-id=id879
doc
A reference to the document that contains the screen annotation.
data-id=13656
data-id=id880
data-id=id881
events
Events objectAn Events object containing the EventListeners that are attached to a screen annotation.
This property is not saved in the PDF file. If you change it, the change affects the current session only.
Example: Create a simple focus EventListener.
var annot = this.media.getAnnot({ nPage:0, cAnnotTitle: "myScreen" });
var myFocusEvent = {
onFocus: function () {
console.println("Focusing...");
}
};
annot.events.add( myFocusEvent );
This EventListener can be removed at a later time by executing the following code.
annot.events.remove( myFocusEvent );
data-id=94094
data-id=extfocusrect
data-id=id882
extFocusRect
When a screen annotation draws a focus rectangle, the rectangle normally encloses only the screen annotation itself. If extFocusRect is specified, the screen annotation takes the union of its normal rectangle and extFocusRect, and it uses the resulting rectangle to draw the focus rectangle.
This property is not saved in the PDF file. If you change it, the change affects the current session only.
data-id=77921
data-id=innerdevicerect
data-id=id883
innerDeviceRect
This property and outerDeviceRect define the interior and exterior rectangles of the screen annotation as it appears in the current page view.
Example: Get the innerDeviceRect.
annot = this.media.getAnnot({ nPage:0, cAnnotTitle: "myScreen" });
console.println("annot.innerDeviceRect = "
+ annot.innerDeviceRect.toSource() );
data-id=95673
data-id=notrigger
data-id=id884
noTrigger
If true, the screen annotation cannot be triggered through the Acrobat user interface. Typically, clicking on a screen annotation starts playback of a media player. This property suppresses this.
This property is not saved in the PDF file. If you change it, the change affects the current session only.
Example: Use form buttons to control the media clip, so turn off interaction with the annotation.
annot = this.media.getAnnot({ nPage:0, cAnnotTitle: "myScreen" });
annot.noTrigger = true;
data-id=96759
data-id=outerdevicerect
data-id=id885
outerDeviceRect
This property and innerDeviceRect define the interior and exterior rectangles of the screen annotation as it appears in the current page view.
data-id=92482
data-id=id886
data-id=id887
page
The page number of the PDF file in which the screen annotation is located.
data-id=16634
data-id=player
data-id=id888
player
A reference to the MediaPlayer associated with a screen annotation. This property exists only for a ScreenAnnot object that is connected to a MediaPlayer. The property is set by MediaPlayer.open or by methods that call open indirectly, such as app.media.openPlayer.
data-id=96047
data-id=id889
data-id=id890
rect
The rectangle of the screen annotation in default user coordinates. Changing this property dirties the PDF file; the new setting is saved if the PDF file is saved. innerDeviceRect and outerDeviceRect are also updated to reflect the new rectangle.
Example: Adjust the position of the annotation slightly.
var annot = this.media.getAnnot({ nPage:0, cAnnotTitle: "myScreen" });
var aRect = annot.rect;
aRect[0] += 10;
aRect[2] += 10;
annot.rect = aRect;
data-id=screenannot-methods
data-id=id891
ScreenAnnot methods
data-id=24895
data-id=hasfocus
data-id=id892
hasFocus
Tells whether the screen annotation currently has the keyboard focus.
Returns
Boolean
data-id=93849
data-id=id893
data-id=id894
setFocus
Sets the keyboard focus to the screen annotation. The focus is set synchronously (before setFocus returns) if it is safe to do so. If it is unsafe to set the focus synchronously (for example, when the property is changed within an on event method), bAllowAsync determines what happens:
- If
true, the focus will be set asynchronously during idle time. - If
falseor omitted, the focus remains unchanged.
The return value is true if the operation was performed synchronously, or false if it was deferred to be performed asynchronously.
Parameters
bAllowAsyncsetFocus when it is not safe to set the focus synchronously. If true, the focus will be set asynchronously during idle time. If false or omitted, the focus remains unchanged. The default is false.Returns
Boolean
data-id=68641
data-id=id895
data-id=id896
search
The search object is a static object that accesses the functionality provided by the Acrobat Search plug-in. This plug-in must be installed to interface with the search object (see available).
See also the Index object, which is returned by some of the methods of the search object.
The results for query calls are displayed in the Find dialog box of Acrobat.
Note
Acrobat 7.0 indexes are incompatible with the search engines of Acrobat 5.0 and earlier versions. As well, in Acrobat 7.0, searching indexes created by versions of Acrobat 5.0 and earlier is not possible on the Mac OS platform.
data-id=search-properties
data-id=id897
search properties
data-id=22722
data-id=attachments
data-id=id898
attachments
Determines whether any PDF file attachments should be searched along with the base document. The default is false.
This property is ignored on the Mac OS platform when searching a document from within the Safari web browser. As a result, attachments are not searched inside Safari.
data-id=29386
data-id=id899
data-id=id900
available
Returns true if the Search plug-in is loaded and query capabilities are possible. A script author should check this Boolean before performing a query or other search object manipulation.
Example: Make sure the search object exists and is available.
if (typeof search != "undefined" && search.available) {
search.query("Cucumber");
}
data-id=80980
data-id=bookmarks
data-id=id901
bookmarks
Specifies whether bookmarks are searched for the query. The default is false.
data-id=89341
data-id=docinfo
data-id=id902
docInfo
Specifies whether the document information is searched for the query. The default is false.
data-id=81268
data-id=doctext
data-id=id903
docText
Specifies whether the document text is searched for the query. The default is true.
data-id=95372
data-id=docxmp
data-id=id904
docXMP
Specifies whether document-level XMP metadata is searched for the query. The default is false.
data-id=85878
data-id=ignoreaccents
data-id=id905
ignoreAccents
Specifies whether accents and diacriticals are ignored while searching the query term. The default is false.
data-id=45257
data-id=ignoreasiancharacterwidth
data-id=id906
ignoreAsianCharacterWidth
Specifies whether the Kana characters in the document exactly match the search query. The default is false.
data-id=96142
data-id=indexes
data-id=id907
indexes
An array of all of the Index objects currently accessible by the search engine.
Note
(Acrobat 7.0) This property can only be accessed during a batch or console event. See priv. The event object contains a discussion of JavaScript events.
Example: Enumerate all of the indexes and dump their names.
for (var i = 0; i < search.indexes.length; i++) {
console.println("Index[" + i + "]=", search.indexes[i].name);
}
data-id=68401
data-id=jpegexif
data-id=id908
jpegExif
Specifies whether EXIF data associated with JPEG images in the PDF document is searched. The default is false.
data-id=15077
data-id=legacysearch
data-id=id909
legacySearch
Note
Beginning with Acrobat 10.0, this property is deprecated. This property will always return false and access is restricted to read only.
Provides the capability to search indexes generated by Acrobat Catalog in Acrobat 5.0 and earlier versions. See the sections in Acrobat Help pertaining to searching such indexes.
data-id=72708
data-id=markup
data-id=id910
markup
Specifies whether markup (annotations) are searched for the query. The default is false.
data-id=17139
data-id=matchcase
data-id=id911
matchCase
Specifies whether the search query is case sensitive. The default is false.
data-id=29234
data-id=matchwholeword
data-id=id912
matchWholeWord
Specifies whether search finds only occurrences of complete words that are specified in the query. For example, when this option is set to true, if you search for the word “stick”, the words “tick” and “sticky” will not be highlighted. The default is false.
data-id=21610
data-id=maxdocs
data-id=id913
maxDocs
The maximum number of documents that will be returned as part of the search query. The default is 100 documents.
data-id=87907
data-id=objectmetadata
data-id=id914
objectMetadata
This property determines whether object-level metadata should be searched. This is the same data that is visible from Tools pane> Interactive objects > Select Object.
The default is false.
data-id=13660
data-id=proximity
data-id=id915
proximity
Specifies whether the search query will reflect the proximity of words in the results ranking when performing the search that contains AND Boolean clauses. The default is false. See the sections in the Acrobat Help pertaining to Search capabilities for a more thorough discussion of proximity.
data-id=26700
data-id=proximityrange
data-id=id916
proximityRange
The range of proximity search in number of words. This property will be used only if the property proximity is set to true. See the sections in the Acrobat Help pertaining to Search capabilities for a more thorough discussion of proximity.
The default is 900 words. The value of this parameter can be any non-zero positive integer.
data-id=29056
data-id=refine
data-id=id917
refine
Specifies whether the search query will take the results of the previous query and refine the results based on the next query. The default is false. See the sections in the Acrobat Help pertaining to Search capabilities for a more thorough discussion of refining queries.
data-id=34599
data-id=stem
data-id=id918
stem
Specifies whether the search query will take the stemming of words (for example, run, runs, running) into account when performing the search. The default is false. See the sections in the Acrobat Help pertaining to Search capabilities for a more thorough discussion of stemming.
data-id=70958
data-id=wordmatching
data-id=id919
wordMatching
How individual words in the query will be matched to words in the document. Values are:
MatchPhrase
MatchAllWords
MatchAnyWord
BooleanQuery (default)
This property is relevant only when a query has more than one word. The BooleanQuery option is ignored when searching the active document.
data-id=search-methods
data-id=id920
search methods
data-id=10631
data-id=addindex
data-id=id921
addIndex
Adds the specified index to the list of searchable indexes.
Note
As of Acrobat 8.1, this method will only index pdx files.
Parameters
Returns
An Index object.
Example: Adds the standard help index for Acrobat to the index list:
search.addIndex("/c/program files/adobe/Acrobat 5.0/help/exchhelp.pdx", true);
data-id=45356
data-id=getindexforpath
data-id=id922
getIndexForPath
Searches the index list and returns the Index object whose path corresponds to the specified path.
Parameters
Returns
The Index object whose path corresponds to the specified path.
data-id=21823
data-id=query
data-id=id923
query
Searches the specified document or index for the specified text. Properties associated with the search object (such as matchCase, matchWholeWord, stem) may affect the result.
Note
As of Acrobat 8.1, if the
cDIPathparameter is specified, this method is only permitted to execute through the console or in a batch process.
Parameters
cQuerycWhereActiveIndexes.cDIPathcWhere is Folder or Index, this parameter is required.Examples
Search for the word “Acrobat”.
ActiveIndexesActiveDocsearch.query("Acrobat", "ActiveDoc");FolderIndexsearch.query("Acrobat", "Index", "/c/Myfiles/public/index.pdx");data-id=25991
data-id=removeindex
data-id=id924
removeIndex
Removes the specified Index object from the index list.
Note
As of Acrobat 8.1, this method is only permitted to execute through the console or in a batch process.
Parameters
indexIndex object to remove from the index list.data-id=56402
data-id=id977
data-id=id978
SOAP
The SOAP object allows remote procedure calls to be made to, or sends an XML Message to, a remote server from JavaScript.
The SOAP 1.1 protocol (see http://www.w3.org/TR/SOAP/) is used to marshall JavaScript parameters to a remote procedure call (either synchronously or asynchronously) and to unmarshall the result as a JavaScript object. The SOAP object also has the ability to communicate with web services, described by the Web Services Description Language (WSDL—see http://www.w3.org/TR/wsdl).
Note
The SOAP methods
connect,requestandresponseare available only for documents open in Acrobat Pro and Acrobat Standard.
data-id=soap-properties
data-id=id979
SOAP properties
data-id=49077
data-id=wiredump
data-id=id980
wireDump
If true, synchronous SOAP requests will cause the XML request and response to be dumped to the JavaScript Console. This is useful for debugging SOAP problems.
Note
Beginning with Acrobat 8.0, this property is deprecated, new services should use
Net.SOAP.wireDump.
data-id=soap-methods
data-id=id981
SOAP methods
data-id=56159
data-id=id982
data-id=id983
connect
Converts the URL of a WSDL document (cURL) to a JavaScript object with callable methods corresponding to the web service.
The parameters to the method calls and the return values obey the rules specified for the SOAP.request method.
Note
Beginning with Acrobat 8.0, this method is deprecated, new services should use
Net.SOAP.connect. Not supported in Acrobat Reader.
Parameters
cURLReturns
A WSDL Service Proxy object with a JavaScript method corresponding to each operation in the WSDL document provided at the URL.
The parameters required for the method depend on the WSDL operation you are calling and how the operation encodes its parameters:
- If the WSDL operation is using the SOAP RPC encoding (as described in Section 7 of the SOAP 1.1 Specification), the arguments to the service method are the same as the parameter order in the WSDL document.
- If the WSDL service is using the SOAP document/literal encoding, the function will have a single argument indicating the request message. The argument may be a JavaScript object literal describing the message or it may be either a string or a
ReadStreamobject with an XML fragment describing the message. The return value of the service method will correspond to the return value of the WSDL operation.
The JavaScript function objects corresponding to each web service method use the following properties if they are set. The default is for none of the properties to be set.
asyncHandleroAsync parameter of SOAP.request.requestHeaderoReqHeader parameter of SOAP.request.responseHeaderoRespHeader parameter of SOAP.request.authenticatoroAuthenticate parameter of SOAP.request.Exceptions
SOAP Faults cause a SOAPError exception to be thrown. If there is a problem at the networking level, such as an unavailable endpoint, a NetworkError is thrown. See the request method for more information.
Example: Echo a string and an integer using an echo service WSDL document.
A service WSDL Document URL is needed. These can be obtained from the “Round 2 Interop Services - using SOAP 1.2” section at the following URL: http://www.whitemesa.com/interop.htm.
var cURL =
<get a URL for this service from
http://www.whitemesa.com/interop.htm>;
// Connect to the test service
var service = SOAP.connect(cURL);
// Print out the methods this service supports to the console
for(var i in service) console.println(i);
var cTestString = "This is my test string";
// Call the echoString service -- it is an RPC Encoded method
var result = service.echoString(cTestString);
// This should be the same as cTestString
console.println(result + " == " + cTestString);
// Call the echoInteger service -- JavaScript doesn't support integers
// so we make our own integer object.
var oTestInt =
{
soapType: "xsd:int",
soapValue: "10"
};
var result = service.echoInteger(oTestInt);
// This should be the same as oTestInt.soapValue
console.println(result + " == " + oTestInt.soapValue);
This produces the following output:
echoBase64
echoBoolean
echoDate
echoDecimal
echoFloat
echoFloatArray
echoHexBinary
echoInteger
echoIntegerArray
echoPolyMorph
echoPolyMorphArray
echoPolyMorphStruct
echoString
echoStringArray
echoStruct
echoStructArray
echoVoid
This is my test string == This is my test string
10 == 10
data-id=74868
data-id=queryservices
data-id=id984
queryServices
Locates network services that have published themselves using DNS Service Discovery (DNS-SD). This method can locate services that have registered using Multicast DNS (mDNS) for location on a local networking link or through unicast DNS for location within an enterprise. The results of service location are always returned asynchronously and the query continues (with notification as services become available or unavailable) until it is stopped.
The result of querying for services is a set of service names that can be bound when needed by calling resolveService.
Services can either use a third-party mDNS responder to be located in the local network link or register themselves in a DNS server (either statically or dynamically) to be located within an enterprise networking environment.
Note
Beginning with Acrobat 8.0, this method is deprecated, new services should use
Net.Discovery.queryServices.
Parameters
cTypeoAsyncqueryServices method returns and are called during idle processing. The oAsync parameter should implement the following methods: * addServices: This method is called when available services matching the query are located. The parameter is an array of Service Description objects for the services that have been added. * removeServices: This method is called when services that had previously been introduced by calling the addServices notification method are no longer available. The parameter is an array of Service Description objects for the services that have been removed. - In Acrobat 7.0, only services located through mDNS (that is, in the “local.” domain) are updated dynamically.aDomainsReturns
A service query object that manages the duration of the query. The query will continue until one of the following conditions is met:
- The service query object returned from
queryServicesis garbage collected. - The
stopmethod of the service query object returned fromqueryServicesis called.
stopExceptions
Standard Acrobat exceptions.
data-id=16405
Service Description Object
The service description object passed to addServices and removeServices have the following properties:
namedomaintypecType parameter passed to queryServices. This can be useful when the same notification callback is being used for multiple queries.Example: Locates network services that have published themselves using DNS Service Discovery.
This example code will produce different output depending on where it is run.
var oNotifications =
{
addServices: function(services)
{
for(var i = 0; i < services.length; i++)
console.println("ADD: "+ services[i].name + " in domain "
+ services[i].domain);
},
removeServices: function(services)
{
for(var i = 0; i < services.length; i++)
console.println("DEL: " + services[i].name + " in domain "
+ services[i].domain);
}
};
SOAP.queryServices({
cType:"http",
oAsync:oNotifications,
aDomains:[ServiceDiscovery.local, ServiceDiscovery.DNS]
});
The output depends on the current network environment; if there are no services advertised by DNS Service Discovery, the example will produce no output. The following is a representative output:
ADD: My Web Server in domain local.
ADD: Joe's Web Server in domain local.
ADD: Example.org Web Server in domain example.org.
data-id=96557
data-id=resolveservice
data-id=id985
resolveService
Allows a service name to be bound to a network address and port in order for a connection to be made. The connection information is returned asynchronously and should be treated as temporary since the network location of a service may change over time (for example, if a DHCP lease expires or if a service moves to a new server).
Note
Beginning with Acrobat 8.0, this method is deprecated, new services should use
Net.Discovery.resolveService.
Parameters
cTypecDomaincServiceoResultReturns
A service query object that manages the duration of the resolve. The resolve will continue until one of the following conditions is met:
- The service query object returned from
resolveServiceis garbage collected. - The
resolvemethod of theoResultobject is called indicating that the operation completed (either by resolving the service, error, or a timeout). - The
stopmethod of the service query object returned fromresolveServiceis called.
stopExceptions
Standard Acrobat exceptions.
data-id=20694
data-id=oresult-parameter
data-id=oresult
oResult parameter
The oResult object is a notification object that will be called when the service is resolved. The notification methods will not be called until the resolveService method returns and are called during idle processing. The oResult parameter should implement the following method:
resolvenStatus and oInfo) when the service is resolved or if it cannot be resolved. The parameter nStatus is the state indicating if the service could be resolved (see below). If the service was successfully resolved, the oInfo object, an instance of the ServiceInfo object (see below), specifies the connection information.The nStatus parameter passed to the resolve method can have one of the following values:
01-1The ServiceInfo object passed to the resolve method has the following properties:
targetportinfohttp://<target>:<port>/<info["path"]>).Example: This example code will produce different output depending on where it is run. If there are no services advertised by DNS Service Discovery, this example will produce no output.
var oNotifications =
{
resolve: function(status, info)
{
if(status == 0)
console.println("RESOLVE: http://"
+ info.target + ":" + info.port + "/"
+ info.info.path);
else console.println("ERROR: " + status);
}
};
SOAP.resolveService({
cType: "http",
cDomain: "local.",
cService: "Joe's Web Server",
oResult: oNotifications
});
The output depends on the current network environment-the following is a representative output:
RESOLVE: http://172.16.0.0:80/index.html
data-id=74380
data-id=id986
data-id=id987
request
Initiates a remote procedure call (RPC) or sends an XML message to a SOAP HTTP endpoint. The method either waits for the endpoint to reply (synchronous processing) or calls a method on the notification object (asynchronous processing).
Note
Beginning with Acrobat 8.0, this method is deprecated, new services should use
Net.SOAP.request. Not supported in Acrobat Reader.
Parameters
cURLoRequestoAsyncoAsync object literal must have a function called response that will be called with two parameters (oResult and cURI) when the response returns. oResult is the same result object that would have been returned from the request call if it was called synchronously. cURI is the URI of the endpoint that the request was made to. (Acrobat 7.0) The oAsync object response callback has the following parameters: * response: The response object from the SOAP request. * uri: The URI that the SOAP request was made to. * exception: An exception object (see the exceptions below) if there was an error, null otherwise. * header: A response SOAP header (see the description of the oRespHeader parameter) or null if there are no response headers.cActionbEncodedtrue.cNamespaceoReqHeaderoRequest object except for two additional properties that can be specified in the request description: * soapActor: The recipient (or actor specified as a URI) that the SOAP header should be processed by. The default is the first recipient to process the request. * soapMustUnderstand: A Boolean value indicating that the request body cannot be interpreted if this header type is not understood by the recipient. The default is that understanding the header is optional.oRespHeaderoAsync callback method otherwise). The default is for the headers not to be returned. See the description of the cResponseStyle parameter for the object format.cVersionoAuthenticateoAuthenticate object can have the following properties: * Username: A string containing the user name to use for authentication. * Password: A string containing the credential to use. * UsePlatformAuth: A Boolean value indicating that platform authentication should be used. If true, Username and Password are ignored and the underlying platform networking code is used. This may cause an authentication UI to be shown to the user and/or the credentials of the currently logged in user to be used. The default is false and is only supported on the Windows platform.cResponseStyleoRespHeader object (in the case of a SOAP header) will be structured: * SOAPMessageStyle.JS: (Default) The response will be an object describing the SOAP Body (or SOAP Header) of the returned message (this is the result that Acrobat 6.0 produced). This is recommended when using the SOAP encoding for the request but is not ideal when using the literal encoding-using the XML or Message style is better. * SOAPMessageStyle.XML: The response will be a stream object containing the SOAP Body (or SOAP Header) as an XMLfragment. If there are any attachments associated with the response, the Stream object will have an object property oAttachments. The object keys are the unique names for the attachment parts and the value must be a Stream object containing the attachment contents. * SOAPMessageStyle.Message: The response will be an object describing the SOAP Body (or SOAP Header) corresponding to the XML Message. This differs from the JavaScript response style in the following ways: * XML Elements are returned as an array of objects rather than an object to maintain order and allow elements with the same name. * XML Attributes are preserved using the soapAttributes property. * Namespaces are processed and returned in the soapName and soapQName properties. * The content of an element is in the soapValue property.cRequestStyleoRequest to be altered. The following values are permitted: * SOAPRequestStyle.SOAP: (the default) The request is made using the SOAP messaging model. * SOAPRequestStyle.RawPost: The oRequest parameter is used as the request body for an HTTP Post. oRequest must be a ReadStream object. If this method is called within the context of a document, the document must be open in the browser. Additionally, the origination URL of the document (scheme, server, and port) must match the origination of the cURL parameter. The response is a ReadStream object with the response from the request.cContentTypeReturns
A response object if the method was called synchronously (that is, there is no oAsync parameter) or nothing if the method was called asynchronously. See the description of cResponseStyle above for the object description.
The SOAP types in the result are mapped to JavaScript types as follows:
ReadStream objectReadStream objectReadStream objectExceptions
SOAPError is thrown when the SOAP endpoint returns a SOAPFault. The SOAPError Exception object has the following properties:
faultCodefaultActorfaultDetailNetworkError is thrown when there is a failure from the underlying HTTPtransport layer or in obtaining a Network connection. The NetworkError Exception object has the property statusCode, which is an HTTP Status code or –1 if the network connection could not be made.
Standard Acrobat exceptions can also be thrown.
Note
If the method was called asynchronously, the exception object may be passed to the
responsecallback method.
data-id=57773
Additional notes on the oRequest parameter
The oRequest parameter is an object literal that specifies the remote procedure name and the parameters to call. The object literal uses the fully qualified method name of the remote procedure as the key. The namespace should be separated from the method name by a colon.
For example, if the namespace for the method is http://mydomain/methods and the method name is echoString, the fully qualified name would be http://mydomain/methods:echoString. The value of this key is an object literal, each key is a parameter of the method, and the value of each key is the value of the corresponding parameter of the method. For example:
oRequest: {
"http://soapinterop.org/:echoString":{inputString: "Echo!"}
}
When passing parameters to a remote procedure, JavaScript types are bound to SOAP types automatically as listed in the table:
ReadStream objectNote
The
xsdnamespace refers to the XML Schema Datatypes namespacehttp://www.w3.org/2001/XMLSchema. TheSOAP-ENCnamespace refers to the SOAP Encoding namespacehttp://schemas.xmlsoap.org/soap/encoding/.
The oRequest object supports the following properties:
soapType<namespace>:<type> notation, for example http://mydomain/types:myType However, the xsd (XMLSchema Datatypes), xsi (XMLSchema Instance), and SOAP-ENC (SOAP Encoding) namespaces are implicitly defined in the SOAP message, so the soapType can use them, as in xsd:int for the XMLSchema Datatype Integer type.soapValueReadStream object. soapValue is passed unescaped (that is, not XML Entity escaped). For example, < is not converted to < in the XML Message. Consequently, soapValue can be a raw XML fragment that will be passed to the XML Message. (Acrobat 7.0) soapValue can now also be an array of nodes that are an ordered set of children of the node in the request message.soapNamevar oIntParameter = { soapType: "xsd:int", soapValue: "1" }; Later, the oRequest parameter for the SOAP.request method might be this: oRequest: { "http://soapinterop.org/:echoInteger": { inputInteger: oIntParameter } } Example 1 below shows this technique.soapAttributessoapQName<ns:local xmlns:ns="urn:example.org">, the element name is a QName consisting of a local name ("local") and a namespace ("urn:example.org"). This object has two properties: * localName: A string indicating the local name of the QName. * nameSpace: A string indicating the namespace of the QName.soapAttachmentsoapValue contents of the node should be encoded as an attachment according to the SwA specification. The soapValue must be a stream if the corresponding soapAttachment property is true, otherwise an exception will be thrown.soapParamOrderbEncoding is true.data-id=44692
Example 1: Use request to initiate a remote procedure call for echo services.
A service WSDL Document URL is needed. It can be obtained from the “Round 2 Interop Services - using SOAP 1.2” section at the following URL: http://www.whitemesa.com/interop.htm.
var cURL =
<get a URL for this service from
http://www.whitemesa.com/interop.htm>;
var cTestString = "This is my test string";
// Call the echoString SOAP method -- it is an RPC Encoded method
var response = SOAP.request(
{
cURL: cURL,
oRequest: {
"http://soapinterop.org/:echoString": {
inputString: cTestString
}
},
cAction: "http://soapinterop.org/"
});
var result =
response["http://soapinterop.org/:echoStringResponse"]["return"];
// This should be the same as cTestString
console.println(result + " == " + cTestString);
// Call the echoInteger SOAP method -- JavaScript doesn't support
// integers so we make our own integer object.
var oTestInt =
{
soapType: "xsd:int",
soapValue: "10"
};
var response = SOAP.request(
{
cURL: cURL,
oRequest: {
"http://soapinterop.org/:echoInteger": {
inputInteger: oTestInt
}
},
cAction: "http://soapinterop.org/"
});
var result =
response["http://soapinterop.org/:echoIntegerResponse"]["return"];
// This should be the same as oTestInt.soapValue
console.println(result + " == " + oTestInt.soapValue);
This produces the following output:
This is my test string == This is my test string
10 == 10
Example 2: Set a SOAP Header and gets it back.
var cURL = <URL of a Service>;
var NS = "http://www.example.com/soap/:";
var oHeader = {};
oHeader[NS + "testSession"] =
{
soapType: "xsd:string",
soapValue: "Header Test String"
};
var oResultHeader = {};
var oRequest = {};
oRequest[NS + "echoHeader"] = {};
var response = SOAP.request(
{
cURL: cURL,
oRequest: oRequest,
cAction: "http://soapinterop.org/",
oReqHeader: oHeader,
oRespHeader: oResultHeader
});
Example 3: A request for echo services with HTTP Authentication.
var oAuthenticator =
{
Username: "myUserName",
Password: "myPassword"
};
var response = SOAP.request(
{
cURL: cURL,
oRequest: {
"http://soapinterop.org/:echoString":
{
inputString: cTestString
}
},
cAction: "http://soapinterop.org/",
oAuthenticate: oAuthenticator
});
data-id=71544
data-id=id988
data-id=id989
response
Initiates a remote procedure call (RPC) or sends an XML message to a SOAP HTTP endpoint without waiting for a reply.
Note
Beginning with Acrobat 8.0, this method is deprecated, new services should use
Net.SOAP.response. Not supported in Acrobat Reader.
Parameters
cURLcURL parameter of SOAP. request.oRequestoRequest parameter of SOAP. request.cActioncAction parameter of SOAP. request.bEncodedtrue.cNamespacebEncoded flag is false). The default is to have no namespace.oReqHeaderoReqHeader parameter of der SOAP. request.cVersioncVersion parameter of SOAP. request.oAuthenticateoAuthenticate parameter of SOAP. request.cRequestStylecRequestStyle for SOAP. request, except that there is no response from the server.cContentTypecContentType for SOAP. request, except that there is no response from the server.Returns
Boolean
Exceptions
If there is a problem at the networking level, such as an unavailable endpoint, a NetworkError will be thrown.
data-id=52655
Example: See request.
data-id=75761
data-id=streamdecode
data-id=id990
streamDecode
Allows the oStream object to be decoded with the specified encoding type, cEncoder. It returns a decoded ReadStream object. Typically, it is used to access data returned as part of a SOAP method that was encoded in Base64 or hex encoding.
Note
Beginning with Acrobat 8.0, this method is deprecated, new services should use
Net.streamDecode(see Net methods).
Parameters
oStreamcEncoderReturns
ReadStream object
data-id=22036
data-id=streamdigest
data-id=id991
streamDigest
Allows the oStream object to be digested with the specified encoding type, cEncoder. It returns a ReadStream object containing the computed digest of the oStream. Typically, this is used to compute a digest to validate the integrity of the original data stream or as part of an authentication scheme for a web service.
Note
Beginning with Acrobat 8.0, this method is deprecated, new services should use
Net.streamDigest(see Net methods).
Parameters
oStreamcEncodercEncoder parameter must be one of the following values: * StreamDigest.MD5: Digest the content using the MD5 Digest Algorithm (see RFC 1321). * StreamDigest.SHA1: Digest the content using the SHA-1 Digest Algorithm (see RFC 3174).Returns
A ReadStream object with the binary digest of the stream. To be used as a string, the result must be converted to a text format such as Base64 or hex using SOAP.streamEncode.
Example: Digest a string by first converting it to a stream, then calling streamDigest.
var srcStm = SOAP.streamFromString("This is a string I want to digest");
var digest = SOAP.streamDigest(srcStm, StreamDigest.SHA1);
data-id=25086
data-id=streamencode
data-id=id992
streamEncode
This function encodes a stream object. Typically, it is used to pass data as part of a SOAP method when it must be encoded in Base 64 or hex encoding.
Note
Beginning with Acrobat 8.0, this method is deprecated, new services should use
Net.streamEncode(see Net methods).
Parameters
oStreamcEncoderReturns
A ReadStream object that has the appropriate encoding applied.
data-id=82501
data-id=streamfromstring
data-id=id993
streamFromString
This function converts a string to a ReadStream object. Typically, this is used to pass data as part of a SOAP method.
Parameters
cStringReturns
ReadStream object
data-id=73242
data-id=stringfromstream
data-id=id994
stringFromStream
This function converts a ReadStream object to a string. Typically, this is used to examine the contents of a stream object returned as part of a response to a SOAP method.
Parameters
oStreamReadStream object to be converted.Returns
String
data-id=11412
data-id=sound
data-id=id995
Sound
This object represents a sound that is stored in the document. The array of all Sound objects can be obtained from the Doc sounds property. See also Doc methods getSound, importSound, and deleteSound.
data-id=sound-properties
data-id=id996
Sound properties
data-id=79739
data-id=id997
data-id=id998
name
The name associated with this Sound object.
Example: Write the names to the console of all embedded sounds in the current document.
console.println("Dumping all sound objects in this document.");
var s = this.sounds;
for (var i = 0; i < this.sounds.length; i++)
console.println("Sound[" + i + "]=" + s[i].name);
data-id=sound-methods
data-id=id999
Sound methods
data-id=17744
data-id=pause
data-id=id1000
pause
Pauses the currently playing sound. If the sound is already paused, the sound play is resumed.
data-id=33208
data-id=play
data-id=id1001
play
Plays the sound asynchronously.
data-id=92859
data-id=id1002
data-id=id1003
stop
Stops the currently playing sound.
data-id=63410
data-id=span
data-id=id1004
Span
A generic object that represents a length of text and its associated properties in a rich text form field or annotation. A rich text value consists of an array of span objects representing the text and formatting.
Note
Span objects are a copy of the rich text value of the field or annotation. To modify and reset the rich text value to update the field, use the Field object
richValueproperty, or theAnnotationobject propertyrichContents, and theeventobject propertiesrichValue,richChange, andrichChangeEx.
data-id=span-properties
data-id=id1005
Span properties
data-id=52413
data-id=id1006
data-id=id1007
alignment
The horizontal alignment of the text. Alignment for a line of text is determined by the first span on the line. The values of alignment are
left
center
right
The default value is left.
Example: The example following superscript uses alignment.
data-id=21820
data-id=fontfamily
data-id=id1008
fontFamily
The font family used to draw the text. It is an array of family names to be searched for in order. The first entry in the array is the font name of the font to use. The second entry is an optional generic family name to use if an exact match of the first font is not found. The generic family names are
symbol, serif, sans-serif, cursive, monospace, fantasy
The default generic family name is sans-serif.
Example: Set the defaultStyle font family for a rich text field.
f = this.getField("Text1");
style = f.defaultStyle;
// If Courier Std is not found on the user's system, use a monospace font
style.fontFamily = ["Courier Std", "monospace" ];
f.defaultStyle = style;
data-id=29520
data-id=fontstretch
data-id=id1009
fontStretch
Specifies the normal, condensed or extended face from a font family to be used to draw the text. The values of fontStretch are
ultra-condensed, extra-condensed, condensed, semi-condensed, normal,
semi-expanded, expanded, extra-expanded, ultra-expanded
The default value is normal.
data-id=58492
data-id=fontstyle
data-id=id1010
fontStyle
Specifies the text is drawn with an italic or oblique font.
italic
normal
The default is normal.
data-id=72325
data-id=fontweight
data-id=id1011
fontWeight
The weight of the font used to draw the text. For the purposes of comparison, normal is anything under 700 and bold is greater than or equal to 700. The values of fontWeight are
100,200,300,400,500,600,700,800,900
The default value is 400.
data-id=62996
data-id=strikethrough
data-id=id1012
strikethrough
If strikethrough is true, the text is drawn with a strikethrough. The default is false.
data-id=43036
data-id=subscript
data-id=id1013
subscript
Specifies the text is subscript. If true, subscript text is drawn with a reduced point size and a lowered baseline. The default is false.
data-id=42303
data-id=superscript
data-id=id1014
superscript
Specifies the text is superscript. If true, superscript text is drawn with a reduced point size and a raised baseline. The default is false.
Example: Write rich text to a rich text field using various properties. See the Field object richValue property for more details and examples.
var f = this.getField("myRichField");
// Create an array to hold the Span objects
var spans = new Array();
// Each Span object is an object, so we must create one
spans[0] = new Object();
spans[0].alignment = "center";
spans[0].text = "The answer is x";
spans[1] = new Object();
spans[1].text = "2/3";
spans[1].superscript = true;
spans[2] = new Object();
spans[2].superscript = false;
spans[2].text = ". ";
spans[3] = new Object();
spans[3].underline = true;
spans[3].text = "Did you get it right?";
spans[3].fontStyle = "italic";
spans[3].textColor = color.red;
// Now assign our array of Span objects to the field using
// field.richValue
f.richValue = spans;
data-id=51541
data-id=id1015
data-id=id1016
text
The text within the span.
Example: The example following superscript uses text.
data-id=21770
data-id=id1017
data-id=id1018
textColor
A color array representing the RGB color to be used to draw the text (see the color object). The default color is black.
Example: The example following superscript uses textColor.
data-id=92976
data-id=id1019
data-id=id1020
textSize
The point size of the text. The value of textSize can be any number between 0 and 32767, inclusive. A text size of zero means to use the largest point size that will allow all text data to fit in the field’s rectangle.
The default text size is 12.0.
Example: The example following the Field object richValue property uses textSize.
data-id=31477
data-id=underline
data-id=id1021
underline
If underline is true, the text is underlined. The default is false.
Example: The example following superscript uses underline.
data-id=11682
data-id=spell
data-id=id1022
spell
This object allows users to check the spelling of Comments and Form Fields and other spelling domains. To be able to use the spell object, the user must have installed the Acrobat Spelling plug-in and the spelling dictionaries.
Note
The
spellobject is not available in versions of Adobe Reader prior to 7.0. In Adobe Reader 7.0, all properties and methods—with the exception ofcustomDictionaryCreate,customDictionaryDeleteandcustomDictionaryExport—are accessible.
data-id=spell-properties
data-id=id1023
spell properties
data-id=83162
data-id=id1024
data-id=id1025
available
true if the spell object is available.
Example:
console.println("Spell checking available: " + spell.available);
data-id=13633
data-id=dictionarynames
data-id=id1026
dictionaryNames
An array of available dictionary names. A subset of this array can be passed to check, checkText, and checkWord, and to spellDictionaryOrder to force the use of a specific dictionary or dictionaries and the order they should be searched.
A listing of valid dictionary names for the user’s installation can be obtained by executing spell.dictionaryNames from the console.
data-id=89351
data-id=dictionaryorder
data-id=id1027
dictionaryOrder
The dictionary array search order specified by the user on the Spelling Preferences panel. The Spelling plug-in will search for words first in the Doc spellDictionaryOrder array if it has been set for the document, followed by this array of dictionaries.
data-id=64363
data-id=domainnames
data-id=id1028
domainNames
The array of spelling domains that have been registered with the Spelling plug-in by other plug-ins. A subset of this array can be passed to check to limit the scope of the spell check.
Depending on the user’s installation, valid domains can include:
Everything
Form Field
All Form Fields
Comment
All Comments
data-id=62448
data-id=languages
data-id=id1029
languages
This property returns the array of available ISO 639-2/3166-1 language/country codes. A subset of this array can be passed to the check, checkText, checkWord, and customDictionaryCreate methods, and to the Doc spellLanguageOrder property to force the use of a specific language or languages and the order they should be searched.
Depending on the user’s installation, valid language/country codes can include codes from the following list.
ca_EScs_CZda_DKnl_NLen_CAen_GBen_USfi_FIfr_CAfr_FRde_DEde_CHel_GRhu_HUit_ITnb_NOnn_NOpl_PLpt_BRpt_PTru_RUes_ESsv_SEtr_TRNote
In Acrobat 7.0, the entries in this array are different from the entries returned in Acrobat 6.0. On input from JavaScript, the Acrobat 6.0 ISO codes are internally mapped onto the new ISO codes in order not to break any JavaScript code developed for Acrobat 6.0. Codes are not translated on output.
Example: List all available language codes.
console.println( spell.languages.toSource() );
data-id=64159
data-id=languageorder
data-id=id1030
languageOrder
The dictionary search order as an array of ISO 639-2, 3166 language codes. It is the order specified by the user on the Spelling Preferences panel. The Spelling plug-in searches for words first in the Doc spellLanguageOrder array if it has been set for the document, followed by this array of languages.
Example: Get a listing of the dictionary search order.
console.println( spell.languageOrder.toSource() );
data-id=spell-methods
data-id=id1031
spell methods
data-id=81814
data-id=adddictionary
data-id=id1032
addDictionary
Note
Beginning with Acrobat 6.0, this method is no longer supported and always returns
false. Use the customDictionaryOpen method instead.
Adds a dictionary to the list of available dictionaries.
A dictionary actually consists of four files: DDDxxxxx.hyp, DDDxxxxx.lex, DDDxxxxx.clx, and DDDxxxxx.env. The cFile parameter must be the device-independent path of the .hyp file, for example, “/c/temp/testdict/TST.hyp “. The Spelling plug-in will look in the parent directory of the TST.hyp file for the other three files. All four file names must start with the same unique 3 characters to associate them with each other, and they must end with the dot three extensions listed above, even in Mac OS.
Parameters
cFilecNamecheck, checkText, and checkWord methods.bShowtrue (the default), then the cName value is combined with “User”. That name is shown in all lists and menus. For example, if cName is “Test”, “User: Test” is added to all lists and menus. If false, this custom dictionary is not shown in any lists or menus.Returns
false
data-id=47325
data-id=addword
data-id=id1033
addWord
Adds a new word to a dictionary. See also the removeWord.
Note
Beginning with Acrobat 7.0, this method is allowed only during a console or batch event. See priv.
Internally, the spell object scans the user “Not-A-Word” dictionary and removes the word if it is listed there. Otherwise, the word is added to the user dictionary. The actual dictionary is not modified.
Parameters
cWordcNamedictionaryNames or languages.Returns
true if successful, otherwise, false.
data-id=46770
data-id=check
data-id=id1034
check
Presents the Spelling dialog box to allow the user to correct misspelled words in form fields, annotations, or other objects.
Parameters
aDomaindomainNames property.aDictionaryspell.dictionaryNames or spell.languages. When this parameter is omitted, the spellDictionaryOrder list will be searched followed by the dictionaryOrder list.Returns
true if the user changed or ignored all the flagged words. When the user dismisses the dialog box before checking everything, the method returns false.
Example: Set the dictionaries, then spell check the comments and form fields of the current document. Reports back to the console.
var dictionaries = ["de", "French", "en-GB"];
var domains = ["All Form Fields", "All Annotations"];
if (spell.check(domains, dictionaries) )
console.println("You get an A for spelling.");
else
console.println("Please spell check this form before you submit.");
data-id=17744
data-id=checktext
data-id=id1035
checkText
Presents the spelling dialog box to allow the user to correct misspelled words in the specified string.
Parameters
cTextaDictionaryspell.dictionaryNames or spell.languages. When this parameter is omitted, the spellDictionaryOrder list will be searched followed by the dictionaryOrder list.Returns
The result from the spelling dialog box in a new string.
Example: Spell check a particular field, and update the spelling in the field.
var f = this.getField("Text Box") // A form text box
f.value = spell.checkText(f.value); // Let the user pick the dictionary
data-id=21151
data-id=checkword
data-id=id1036
checkWord
Checks the spelling of a specified word.
Parameters
cWordaDictionaryspell.dictionaryNames or spell.languages. If this parameter is omitted, the spellDictionaryOrder list is searched, followed by the dictionaryOrder list.Returns
A null object if the word is correct, otherwise an array of alternative spellings for the unknown word.
Example 1: Insert the array of suggested alternative spellings into a list box.
var word = "subpinna"; /* misspelling of "subpoena" */
var dictionaries = ["English"];
var f = this.getField("Alternatives") // Alternative spellings list box
f.clearItems();
f.setItems(spell.checkWord(word, dictionaries));
data-id=86751
Example 2: The following script marks misspelled words in the document with a squiggle annotation whose contents are the suggested alternative spellings. The script can be executed from the console, as a mouse-up action within the document, a menu, or as a batch sequence.
var ckWord, numWords;
for (var i = 0; i < this.numPages; i++ )
{
numWords = this.getPageNumWords(i);
for (var j = 0; j < numWords; j++)
{
ckWord = spell.checkWord(this.getPageNthWord(i, j))
if ( ckWord != null )
{
this.addAnnot({
page: i,
type: "Squiggly",
quads: this.getPageNthWordQuads(i, j),
author: "A. C. Acrobat",
contents: ckWord.toString()
});
}
}
}
data-id=10279
data-id=customdictionaryclose
data-id=id1037
customDictionaryClose
Closes a custom dictionary that was opened using customDictionaryOpen or customDictionaryCreate.
Parameters
cNameReturns
true if successful, false on failure.
data-id=65594
data-id=customdictionarycreate
data-id=id1038
customDictionaryCreate
Use this method to create a new custom dictionary file and add it to the list of available dictionaries.
Note
This method is allowed only during a console or batch event. See priv.
Parameters
cNamecheck, checkText, and checkWord methods.cLanguagebShowtrue (the default), the cName parameter is combined with “User: “ and shown that name in all lists and menus. For Example, if cName is “Test”, “User: Test” is added to all lists and menus. When bShow is false, this custom dictionary is not shown in any lists or menus.Returns
true if successful, false on failure. This method will fail if the user does not have read and write permission to this directory.
Example: Open a PDF document in Acrobat and execute the following script in the console. This script extracts the first word of each bookmark. If that word is already in a dictionary, it is discarded. An unknown word is added into a newly created dictionary, called JavaScript” in this case.
spell.customDictionaryCreate("JavaScript", "en", true);
function GetJSTerms(bm, nLevel)
{
var newWord = bm.name.match(re);
var ckWord = spell.checkWord( newWord[0] );
if ( ckWord != null )
{
var cWord = spell.addWord( newWord[0], "JavaScript");
if ( cWord ) console.println( newWord[0] );
}
if (bm.children != null)
for (var i = 0; i < bm.children.length; i++)
GetJSTerms(bm.children[i], nLevel + 1);
}
console.println("nAdding New words to the "JavaScript" "
+ "dictionary:");
var re = /^w+/;
GetJSTerms(this.bookmarkRoot, 0);
data-id=27386
data-id=customdictionarydelete
data-id=id1039
customDictionaryDelete
Use this method to close and delete a custom dictionary file that was opened by customDictionaryOpen or customDictionaryCreate.
Note
This method is allowed only during a console or batch event. See priv.
Parameters
cNameReturns
true if successful, false on failure. This method will fail if the user does not have sufficient file system permission.
Example: Delete a custom dictionary.
spell.customDictionaryDelete("JavaScript");
data-id=36485
data-id=customdictionaryexport
data-id=id1040
customDictionaryExport
Exports a custom dictionary to a new file that was opened using the spell methods customDictionaryOpen or customDictionaryCreate.
The user is prompted for an export directory, where the custom dictionary is saved as a .clam file using the dictionary name and language specified in customDictionaryCreate. For example, if the dictionary name is “JavaScript” and the “en” language as specified when it was created, the export file name will be JavaScript-eng.clam.
Exported custom dictionaries can be used in subsequent customDictionaryOpen calls.
Note
This method is allowed only during a console or batch event. See priv.
Parameters
cNameReturns
true if successful, false on failure. This method will fail if the user does not have sufficient file system permission.
Example: Export a custom dictionary, which can then be sent to other users. (See the example that follows customDictionaryCreate.)
spell.customDictionaryExport("JavaScript");
data-id=30271
data-id=customdictionaryopen
data-id=id1041
customDictionaryOpen
Adds a custom export dictionary to the list of available dictionaries. See customDictionaryExport.
Note
A custom dictionary file can be created using the
customDictionaryCreateandcustomDictionaryExportmethods.
Parameters
cDIPathcNamecheck, checkText, and checkWord methods.bShowtrue, the default, the cName parameter is combined with “User: “ and that name is shown in all lists and menus. For example, if cName is “Test”, add “User: Test” is added to all lists and menus. When bShow is false, this custom dictionary is not shown in any lists or menus.Returns
true if successful, false on failure. This method fails if the user does not have read permission for the file.
Example: This example continues the ones following customDictionaryCreate and customDictionaryExport. It adds a custom export dictionary to the list of available dictionaries.
The user places the custom export dictionary in any folder for which there is read/write permission. A particular choice is the user dictionaries folder, whose location of can be obtained from the app.getPath method.
app.getPath("user", "dictionaries");
After the export dictionary has been placed, listing it can be made automatic by adding some folder-level JavaScript. The path to the user JavaScripts folder can be obtained by executing
app.getPath("user", "javascript");
Finally, create a .js file in this folder and add the line
var myDictionaries = app.getPath("user", "dictionaries");
spell.customDictionaryOpen( myDictionaries, "JavaScripts", true);
The next time Acrobat is started, the “JavaScript” dictionary will be open and available.
data-id=68941
data-id=ignoreall
data-id=id1042
ignoreAll
Adds or removes a word from the Spelling ignored-words list of the current document.
Parameters
cWordbIgnoretrue (the default), the word is added to the document ignored word list; if false, the word is removed from the ignored list.Returns
true if successful. This method throws an exception if no document is open.
Example:
var bIgnored = spell.ignoreAll("foo");
if (bIgnored) console.println(""foo" will be ignored);
data-id=17528
data-id=removedictionary
data-id=id1043
removeDictionary
Note
Beginning with Acrobat 6.0, this method is no longer supported. The return value of this method is always
false. Use the customDictionaryClose method.
Removes a user dictionary that was added with addDictionary.
Parameters
cNameaddDictionary.Returns
false
data-id=37786
data-id=removeword
data-id=id1044
removeWord
Removes a word from a dictionary. Words cannot be removed from user dictionaries that were created using either customDictionaryCreate or customDictionaryExport.
See also addWord.
Note
Internally, the
spellobject scans the user dictionary and removes the previously added word if it is there. Otherwise, the word is added to the user’s “Not-A-Word” dictionary. The actual dictionary is not modified.
As of Acrobat 8.1, this method is only permitted to execute through the console or in a batch process.
Parameters
cWordcNamedictionaryNames or languages.Returns
true if successful, false otherwise
data-id=51706
data-id=userwords
data-id=id1045
userWords
Gets the array of words a user has added to, or removed from, a dictionary. See also addWord and checkWord.
Parameters
cNamedictionaryNames or languages. If cName is not specified, the default dictionary is used. The default dictionary is the first dictionary specified in the Spelling preferences dialog box.bAddedtrue, return the user’s array of added words. If false, return the user’s array of removed words. The default is true.Returns
The user’s array of added or removed words.
Example: List the words added to the “JavaScript” dictionary. (See the example that follows the description of customDictionaryCreate.)
var aUserWords = spell.userWords({cName: "JavaScript"});
aUserWords.toSource();
data-id=32392
data-id=tableinfo
data-id=id1046
TableInfo
This generic JavaScript object contains basic information about a table. It is returned by connection.getTableList and contains the following properties.
namedescriptiondata-id=79743
data-id=template
data-id=id1047
Template
Template objects are named pages within the document. These pages may be hidden or visible and can be copied or spawned. They are typically used to dynamically create content (for example, to add pages to an invoice on overflow).
See also the Doc templates property, and createTemplate, getTemplate, and removeTemplate methods.
data-id=template-properties
data-id=id1048
Template properties
data-id=78212
data-id=id1049
data-id=id1050
hidden
Determines whether the template is hidden. Hidden templates cannot be seen by the user until they are spawned or are made visible. When an invisible template is made visible, it is appended to the document.
This property behaves as follows in Adobe Reader:
- Setting this property in versions of Adobe Reader earlier than 5.1 generates an exception.
- For Adobe Reader 5.1 and 6.0, setting this property depends on Advanced Forms Feature document rights.
- For Adobe Reader 7.0, this property cannot be set under any circumstances.
data-id=16107
data-id=id1051
data-id=id1052
name
The name of the template that was supplied when the template was created.
data-id=template-methods
data-id=id1053
Template methods
data-id=97092
data-id=spawn
data-id=id1054
spawn
Creates a new page in the document based on the template.
Parameters
nPagebOverlay. The default is 0.bRenametrue.bOverlaytrue (the default), the template is overlaid on the specified page. If false, it is inserted as a new page before the specified page. To append a page to the document, set bOverlay to false and set nPage to the number of pages in the document. - For certified documents or documents with Advanced Form Features rights, the bOverlay parameter is disabled. A template cannot be overlaid for these types of documents.oXObjectspawn.Returns
Prior to Acrobat 6.0, this method returned nothing. Now, spawn returns an object representing the page contents of the page spawned. This return object can then be used as the value of the optional parameter oXObject for subsequent calls to spawn.
Note
Repeatedly spawning the same page can cause a large increase in the file size. To avoid this problem,
spawnnow returns an object that represents the page contents of the spawned page. This return value can be used as the value of theoXObjectparameter in subsequent calls to thespawnmethod to spawn the same page.
Example 1: Spawn all templates and appends them one by one to the end of the document.
var a = this.templates;
for (i = 0; i < a.length; i++)
a[i].spawn(this.numPages, false, false);
Example 2 (Acrobat 6.0)
Spawn the same template 31 times using the oXObject parameter and return value. Using this technique avoids overly inflating the file size.
var t = this.templates;
var T = t[0];
var XO = T.spawn(this.numPages, false, false);
for (var i=0; i<30; i++) T.spawn(this.numPages, false, false, XO);
data-id=87483
data-id=id1055
data-id=id1056
Thermometer
This object is a combined status window and progress bar that indicates to the user that a lengthy operation is in progress. To acquire a Thermometer object, use app.thermometer.
Example: This example shows how to use all properties and methods of the Thermometer object.
var t = app.thermometer; // Acquire a thermometer object
t.duration = this.numPages;
t.begin();
for ( var i = 0; i < this.numPages; i++)
{
t.value = i;
t.text = "Processing page " + (i + 1);
if (t.cancelled) break; // Break if the operation is cancelled
.
.. process the page ...
}
t.end();
data-id=thermometer-properties
data-id=id1057
Thermometer properties
data-id=74557
data-id=cancelled
data-id=id1058
cancelled
Specifies whether the user wants to cancel the current operation. The user can indicate the desire to terminate the operation by pressing the Esc key on the Windows and UNIX platforms and Command-period on the Mac OS platform.
data-id=35975
data-id=duration
data-id=id1059
duration
Sets the value that corresponds to a full thermometer display. The thermometer is subsequently filled in by setting its value. The default duration is 100.
data-id=17228
data-id=id1060
data-id=id1061
text
Sets the text string that is displayed by the thermometer.
data-id=68275
data-id=id1062
data-id=id1063
value
Sets the current value of the thermometer and updates the display. The value can range from 0 (empty) to the value set in duration. For example, if the thermometer’s duration is 10, the current value must be between 0 and 10, inclusive. If the value is less than zero, it is set to zero. If the value is greater than duration, it is set to duration.
data-id=thermometer-methods
data-id=id1064
Thermometer methods
data-id=37386
data-id=begin
data-id=id1065
begin
Initializes the thermometer and displays it with the current value as a percentage of the duration.
Example: Count the words on each page of the current document, report the running total, and use the thermometer to track progress.
var t = app.thermometer; // acquire a thermometer object
t.duration = this.numPages;
t.begin();
var cnt=0;
for ( var i = 0; i < this.numPages; i++)
{
t.value = i;
t.text = "Processing page " + (i + 1);
cnt += getPageNumWords(i);
console.println("There are " + cnt + "words in this doc.");
if (t.cancelled) break;
}
t.end();
data-id=93535
data-id=id1066
data-id=id1067
end
Draws the thermometer with its current value set to the thermometer’s duration (a full thermometer), then removes the thermometer from the display.
data-id=92096
data-id=this
data-id=id1068
this
In JavaScript, the special keyword this refers to the current object. In Acrobat, the current object is defined as follows:
- In an object method, it is the object to which the method belongs.
- In a constructor function, it is the object being constructed.
- In a document-level script or field-level script, it is the Doc and therefore can be used to set or get document properties and functions.
- In a function defined in one of the folder-level JavaScripts files, it is undefined. Calling functions should pass the Doc to any function at this level that needs it.
For example, assume that the following function was defined at the plug-in folder level:
function PrintPageNum(doc)
{ /* Print the current page number to the console. */
console.println("Page = " + doc.pageNum);
}
The following script outputs the current page number to the console twice and then prints the page:
/* Must pass the Doc. */
PrintPageNum(this);
/* Same as the previous call. */
console.println("Page = " + this.pageNum);
/* Prints the current page. */
this.print(false, this.pageNum, this.pageNum);
Variables and functions that are defined in scripts are parented off of the this object. For example:
var f = this.getField("Hello");
is equivalent to
this.f = this.getField("Hello");
with the exception that the variable f can be garbage collected at any time after the script is run.
Variable and function name conflicts
JavaScript programmers should avoid using property and method names from the Doc as variable names. Using method names after the reserved word var will throw an exception, as the following line shows:
var getField = 1; // TypeError: redeclaration of function getField
Use of property names will not throw an exception, but the value of the property may not be altered if the property refers to an object:
// "title" will return "1", but the document will now be named "1".
var title = 1;
// Property not altered, info still an object
var info = 1; // "info" will return [object Info]
The following is an example of avoiding variable name clash.
var f = this.getField("mySignature"); // uses the ppklite sig handler
// Use "Info" rather than "info" to avoid a clash
var Info = f.signatureInfo();
// Some standard signatureInfo properties
console.println("name = " + Info.name);
data-id=24782
data-id=tts
data-id=id1069
TTS
The JavaScript TTS object allows users to transform text into speech. To be able to use the TTS object, the user’s computer must have a Text-To-Speech engine installed on it. The Text-To-Speech engine will render text as digital audio and then speak it. It has been implemented mostly with accessibility in mind but can potentially have many other applications. The TTS object is present on both the Windows and Mac OS platforms (since it is a JavaScript object).
Note
Acrobat 5.0 has taken a very different approach to providing accessibility for disabled users by integrating directly with popular screen readers. Therefore, some of the screen reading features defined in 4.05 using the TTS object have been removed in 5.0 because they conflict with the screen reader. The TTS object remains, however, because it still has useful functionality in its own right that might be popular for multimedia documents.
data-id=tts-properties
data-id=id1070
TTS properties
data-id=17738
data-id=id1071
data-id=id1072
available
true if the TTS object is available and the Text-To-Speech engine can be used.
Example:
console.println("Text to speech available: " + tts.available);
data-id=65337
data-id=numspeakers
data-id=id1073
numSpeakers
The number of speakers available to the Text-To-Speech engine. See also the speaker property and the getNthSpeakerName method.
data-id=40775
data-id=pitch
data-id=id1074
pitch
Sets the baseline pitch for the voice of a speaker. The valid range for pitch is from 0 to 10, with 5 being the default for the mode.
data-id=37694
data-id=soundcues
data-id=id1075
soundCues
-
- Version (Key)
- Save-Prefs
- Security
- Product
- Type
- Access
-
- deprecated
- No
- No
- All
- Boolean
- R/W
Deprecated. Returns false.
data-id=16595
data-id=speaker
data-id=id1076
speaker
Allows users to specify different speakers with different tone qualities when performing text-to-speech. See also the numSpeakers property and the getNthSpeakerName method.
data-id=96528
data-id=speechcues
data-id=id1077
speechCues
-
- Version (Key)
- Save-Prefs
- Security
- Product
- Type
- Access
-
- deprecated
- No
- No
- All
- Boolean
- R/W
Deprecated. Returns false.
data-id=91461
data-id=speechrate
data-id=id1078
speechRate
Sets the speed at which text will be spoken by the Text-To-Speech engine. The value for speechRate is expressed in number of words per minute.
data-id=13865
data-id=volume
data-id=id1079
volume
Sets the volume for the speech. Valid values are 0 (mute) to 10 (loudest).
data-id=tts-methods
data-id=id1080
TTS methods
data-id=71154
data-id=getnthspeakername
data-id=id1081
getNthSpeakerName
Gets the n th speaker name in the Text-To-Speech engine (see also the numSpeakers and speaker properties).
Parameters
nIndexReturns
The name of the specified speaker.
Example: Enumerate through all of the speakers available.
for (var i = 0; i < tts.numSpeakers; i++) {
var cSpeaker = tts.getNthSpeakerName(i);
console.println("Speaker[" + i + "] = " + cSpeaker);
tts.speaker = cSpeaker;
tts.qText ("Hello");
tts.talk();
}
data-id=42857
data-id=id1082
data-id=id1083
pause
Immediately pauses text-to-speech output on a TTS object. Playback of the remaining queued text can be resumed by calling resume.
data-id=21233
data-id=qsilence
data-id=id1084
qSilence
Queues a period of silence into the text.
Parameters
nDurationdata-id=82021
data-id=qsound
data-id=id1085
qSound
Puts the specified sound into the queue to be performed by talk. It accepts one parameter, cSound, from a list of possible sound cue names. These names map directly to sound files stored in the SoundCues folder, if it exists.
tts.qSound("DocPrint"); // Plays DocPrint.wav
The SoundCues folder should exist at the program level for the viewer, for example, C:Program FilesAdobeAcrobat 9.0SoundCues.
Note
Windows only—
qSoundcan handle only 22 KHz,16-bit PCM.wav files. These should be at least 1 second long to avoid a queue delay problem in MS SAPI. If the sound lasts less than 1 second, it should be edited and have a silence added to the end of it.
Parameters
cSounddata-id=23481
data-id=qtext
data-id=id1086
qText
Puts text into the queue to be performed by talk.
Parameters
cTextExample:
tts.qText("Hello, how are you?");
data-id=90260
data-id=reset
data-id=id1087
reset
Stops playback of queued text and flushes the queue. It also resets all the properties of the TTS object to their default values. Text playback cannot be resumed with resume.
data-id=91678
data-id=resume
data-id=id1088
resume
Resumes playback of text on a paused TTS object.
data-id=68290
data-id=id1089
data-id=id1090
stop
Stops playback of queued text and flushes the queue. Playback of text cannot be resumed with resume.
data-id=22624
data-id=talk
data-id=id1091
talk
Sends whatever is in the queue to be spoken by the Text-To-Speech engine. If text output had been paused, talk resumes playback of the queued text.
Example:
tts.qText("Hello there!");
tts.talk();
data-id=70434
data-id=util
data-id=id1092
util
A static JavaScript object that defines a number of utility methods and convenience functions for string and date formatting and parsing.
data-id=util-methods
data-id=id1093
util methods
data-id=98835
data-id=crackurl
data-id=id1094
crackURL
Breaks a URL into its component parts.
Beginning with version 9.0, util.crackURL can break a URL that uses Internet Protocol version 6 (IPv6) addressing. The return object for util.crackURL includes an additional property, nURLType, to help determine the IP type of the URL being passed to the argument of util.crackURL.
No effort is made to determine the IP type if a direct URL is not used and the corresponding DNS name is used.
Parameters
cURLReturns
An object containing the following properties:
cSchemefile, http or https.cUsercPasswordcHostnPortcPathcQuerycFragmentnURLTypecURL uses IPv4 and a value of 1 if cURL uses IPv6. (IPv4 and IPv6 refer to the Internet Protocol versions 4 and 6, respectively.)This method throws a parameter error if the parameter is missing, the URL is not well-formed, or the URL scheme is not file, http, or https.
Example 1: The following code
util.crackURL("http://example.org/myPath?name0=value0&name1=value1#frag");
would return
{
cScheme: "http",
cHost: "example.org",
nPort: 80,
cPath: "/myPath",
cQuery
: "name0=value0&name1=value1",
cFragment: "frag"
}
Example 2 (Version 9.0)
Version 9.0 can break a URL into its components when the URL uses version 6 Internet Protocol.
var a = util.crackURL("http://[2001:1890:110b:15ce:250:56ff:febb:6111]/Ex");
if ( a.nURLType == 1 )
console.println("host = [" + a.cHost + "]");
else
console.println("host = " + a.cHost);
data-id=71009
data-id=iconstreamfromicon
data-id=id1095
iconStreamFromIcon
Converts an XObject-based Icon object into an Icon Stream object.
Parameters
oIconIcon object to be converted into an Icon Stream object.Returns
Icon Stream object
This method allows an icon obtained from the Doc importIcon or getIcon methods to be used in a method such as app.addToolButton, which would otherwise accept only an Icon Stream object as an input parameter.
Example: Import an icon into the document-level named icons tree and add a toolbutton to the application.
this.importIcon("myIcon", "/C/temp/myIcon.jpg", 0);
var oIcon = util.iconStreamFromIcon(this.getIcon("myIcon"));
app.addToolButton({
cName: "myButton",
oIcon: oIcon,
cExec: "console.println('My Button!');",
cTooltext: "My button!",
nPos: 0
});
data-id=84295
data-id=printd
data-id=id1096
printd
Returns a date using a specified format.
Parameters
cFormatbXFAPicture is true, this parameter is interpreted using the XFA Picture Clause format.oDateDate constructor of core JavaScript or from the util.scand method.bXFAPicturecFormat is interpreted using the XFA Picture Clause format, which gives extensive support for localized times and dates. See the sections on date and time pictures in XFA Specification. The default is false.Returns
The formatted date string.
data-id=42262
cFormat String Patterns
Example 1: Format the current date in long format:
var d = new Date();
console.println("Today is " + util.printd("mmmm dd, yyyy", d));
Example 2 (Acrobat 5.0)
Display the date in a local format
console.println(util.printd(2, new Date() ));
Example 3 (Acrobat 7.0)
Use the XFA-Picture Clause to write the current date to the console.
// Execute in console
console.println(
util.printd("EEE, 'the' D 'of' MMMM, YYYY", new Date(), true));
// The output on this day is
Tue, the 13 of July, 2004
Locale-Sensitive Picture Clauses. Normally processing of picture clauses occurs in the ambient locale. It is possible, however, to indicate that picture processing be done in a specific locale. This is of use when formatting or parsing data that is locale-specific and different from the ambient locale. The syntax for this extension to compound picture clauses is:
category-name(locale-name){picture-symbols}
The code executed in the console,
util.printd("date(fr){DD MMMM, YYYY}", new Date(), true)
yields the output on this day,
13 juillet, 2004
The XFA-Picture Clause gives extensive support for Chinese, Chinese (Taiwan), Japanese, and Korean (CCJK) times and dates. The example below, a custom format script of a text field, gives the current date formatted for a Japanese locale.
event.value = util.printd("date(ja){ggYY/M/D}", new Date(), true)
data-id=95657
data-id=printf
data-id=id1097
printf
Formats one or more arguments as a string according to a format string. It is similar to the C function of the same name. This method converts and formats incoming arguments into a result string according to a format string (cFormat).
The format string consists of two types of objects:
- Ordinary characters, which are copied to the result string.
- Conversion specifications, each of which causes conversion and formatting of the next successive argument to
printf.
Each conversion specification is constructed as follows:
%[,nDecSep][cFlags][nWidth][.nPrecision]cConvChar
The following table describes the components of a conversion specification.
nDecSep,) followed by a digit that indicates the decimal/separator format: * 0: Comma separated, period decimal point * 1: No separator, period decimal point * 2: Period separated, comma decimal point * 3: No separator, comma decimal pointcFlagsf, the output will always have a decimal point.nWidthcFlags contains 0).nPrecision.) followed by a number that specifies the number of digits after the decimal point for float conversions.cConvCharParameters
cFormatarguments% tags specified in the first parameter, the format string. The number of optional arguments must be the same as the number of % tags.Note
The
util.printffunction does not accept an object literal with properties that contain the arguments. Arguments are entered in the usual comma-delimited list.
Returns
A result string formatted as specified.
Example: Take an irrational number and display it using various formats of util.printf.
var n = Math.PI * 100;
console.clear();
console.show();
console.println(util.printf("Decimal format: %d", n));
console.println(util.printf("Hex format: %x", n));
console.println(util.printf("Float format: %.2f", n));
console.println(util.printf("String format: %s", n));
The output of the above script is as follows:
Decimal format: 314
Hex format: 13A
Float format: 314.16
String format: 314.159265358979
data-id=86394
data-id=printx
data-id=id1098
printx
Formats a source string, cSource, according to a formatting string, cFormat. A valid format for cFormat is any string that may contain special masking characters:
><Parameters
cFormatcSourceReturns
The formatted string.
Example: Format a string as a U.S. telephone number.
var v = "aaa14159697489zzz";
v = util.printx("9 (999) 999-9999", v);
console.println(v);
data-id=readfileintostream
data-id=id1099
readFileIntoStream
Loads an external file into a JavaScript stream, optionally base64 encodes it, and returns the content as a base64 encoded stream.
Parameters
cDIPathcDIPath parameter is specified, this method can only be executed in privileged context, during a batch or console event (or when the document is certified with a certificate trusted to execute “embedded high privileged JavaScript”).bEncodeBase64Returns
The File content as a ReadStream object that is optionally base 64-encoded.
Example: Assume there is a text field myField in this document. This example reads the contents of a file c:/data/myData.txt in a ReadStream object, converts it to a string, and displays it in the multiline text field.
var rStream = util.readFileIntoStream("/c/data/myData.txt");
var cFile = util.stringFromStream(rStream);
this.getField("myTextField").value = cFile;
data-id=30061
data-id=scand
data-id=id1100
scand
Converts a date into a JavaScript Date object according to the rules of a format string. This routine is much more flexible than using the date constructor directly.
Note
Given a two-digit year for input,
scanduses the date horizon heuristic to resolve the ambiguity. If the year is less than 50, it is assumed to be in the 21st century (that is, add 2000). If it is greater than or equal to 50, it is in the 20th century (add 1900).
The supplied date cDate should be in the same format as described by cFormat.
Parameters
cFormatcFormat uses the same syntax as found in printd.cDateReturns
The converted Date object, or null if the conversion fails.
Example 1:
/* 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 order. */
console.println("Yet again: " + util.printd("yyyy mmm dd", d));
Example 2: Retrieve a text field value, see if it is a date of the acceptable format, then report results in an alert box or the console window.
The method returns null if the conversions fails, which can occur if the user inputs a data different than what is expected. In this case, test the return value for null.
var d= util.scand("mm/dd/yyyy", this.getField("myDate").value);
if ( d== null )
app.alert("Please enter a valid date of the form" +
" "mm/dd/yyyy".")
else {
console.println("You entered the date: "
+ util.printd("mmmm dd, yyyy",d));
}
data-id=18255
data-id=spanstoxml
data-id=id1101
spansToXML
Converts an array of Span objects into an XML(XFA) String as described in the PDF Reference.
Parameters
Span objectsReturns
String
Example: Get the value of a rich text field, turns all of the text blue, converts it to an XML string and then prints it to the console.
var f = getField("Text1");
var spans = f.richValue;
for(var index = 0; index < spans.length; index++)
spans[index].textColor = color.blue;
console.println(util.spansToXML(spans));
data-id=10740
data-id=id1102
data-id=id1103
streamFromString
Converts a string to a ReadStream object.
Parameters
cStringReadStream object.cCharSetcString. The options are utf-8, utf-16, Shift-JIS, BigFive, GBK, UHC. The default is utf-8.Returns
ReadStream object
Example: Take the response given in a text field of this document and append it to an attached document.
var v = this.getField("myTextField").value;
var oFile = this.getDataObjectContents("MyNotes.txt");
var cFile = util.stringFromStream(oFile, "utf-8");
cFile += "rn" + cFile;
oFile = util.streamFromString( cFile, "utf-8");
this.setDataObjectContents("MyNotes.txt", oFile);
This example uses the Doc methods getDataObjectContents and setDataObjectContents and util.stringFromStream.
data-id=25458
data-id=id1104
data-id=id1105
stringFromStream
Converts a ReadStream object to a string.
Parameters
oStreamReadStream object to be converted into a string.cCharSetoStream. The options are utf-8, utf-16, Shift-JIS, BigFive, GBK, UHC. The default is utf-8.Returns
String
Example: Assume there is a text file embedded in this document. This example reads the contents of the attachment and displays it in the multiline text field.
var oFile = this.getDataObjectContents("MyNotes.txt");
var cFile = util.stringFromStream(oFile, "utf-8");
this.getField("myTextField").value = cFile;
This example uses getDataObjectContents to get the file stream of the attached document.
data-id=70013
data-id=xmltospans
data-id=id1106
xmlToSpans
Converts an XML (XFA) string, as described in the PDF Reference, to an array of Span objects suitable for specifying as the richValue or richContents of a field or annotation.
Parameters
Span objects.Returns
An Array of Span objects
Example: Get the rich text string from “Text1”, convert it to XML, then convert it back to an array of Span objects and repopulate the text field.
var f = getField("Text1");
var spans = f.richValue;
var str = util.spansToXML(spans);
var spans = util.xmlToSpans(str);
f.richValue = spans;
data-id=22317
data-id=xfa
data-id=id1108
XFA
The XFA object provides access to the XFA appModel container. More detailed information is available in the JavaScript Developer Guide.
An XFA object is returned by the XMLData.parse and XMLData.applyXPath methods.
Example: The following code detects whether the PDF document has Acrobat forms or was created by LiveCycle Designer and has XML forms. The script can be run in the console, or as a batch sequence; in the latter case, the script can be used to classify all selected document as an XML form (dynamic or static) or as an Acrobat form.
// This script assumes you are using Acrobat 8.0.
console.println("Document name: " + this.documentFileName);
// The xfa object is undefined in an Acrobat form.
if ( typeof xfa == "object" ) {
if ( this.dynamicXFAForm )
console.println(" This is a dynamic XML form.");
else
console.println(" This is a static XML form.");
if ( this.XFAForeground )
console.println(" This document has imported artwork");
}
else console.println(" This is an Acrobat form.");
data-id=43545
data-id=xmldata
data-id=id1109
XMLData
XMLData is a static object that allows the creation of a JavaScript object representing an XML document tree and permits the manipulation of arbitrary XML documents through the XFA Data DOM. (In XFA, there are several other DOMs parallel to the Data DOM, but for the purpose of the XMLData object, only the Data DOM is used.)
PDF documents that return true to the Doc dynamicXFAForm property can use the XMLData object but cannot have its form fields manipulated by that object, because the two data DOMs are isolated from each other.
data-id=xmldata-methods
data-id=id1110
XMLData methods
data-id=36467
data-id=applyxpath
data-id=id1111
applyXPath
Enables you to manipulate and query an XML document by using XPath expressions. The XPath language is described in the W3C document XML Path Language (XPath), which is available at http://www.w3.org/TR/xpath.
XPath expressions evaluate to one of the known four types: Boolean, Number, String, Node-set. In JavaScript, they are returned, respectively, as the following types: Boolean, Number, String, and Object.
If an object is returned, it is of type XFA object, which represents either a tree started by a single node or a tree started by a list of nodes (a tree list). The type of this object is the same as the one returned by the XMLData.parse.
Note
XFA provides a query mechanism, SOM expressions, which is similar to that of XPath. Because XPath is widely used in the XML community, the
applyXPathmethod allows users to use XPath expressions if they choose.
Parameters
oXmlcXPathReturns
Boolean, Number, String, or XFAObject.
data-id=47440
Example: This example shows each of the return types of XMLData.applyXPath (Boolean, number, string, or XFAObject). It extracts information from an XML data string, in this case, the family tree of the “Robat” family).
var cXMLDoc = "<family name = 'Robat'>
<grandad id = 'm1' name = 'A.C.' gender='M'>
<child> m2 </child>
<personal>
<income>100000</income>
</personal>
</grandad>
<dad id = 'm2' name = 'Bob' gender='M'>
<parent> m1 </parent>
<spouse> m3 </spouse>
<child> m4 </child>
<child> m5 </child>
<child> m6 </child>
<personal>
<income>75000</income>
</personal>
</dad>
<mom id = 'm3' name = 'Mary' gender='F'>
<spouse> m2 </spouse>
<personal>
<income>25000</income>
</personal>
</mom>
<daughter id = 'm4' name = 'Sue' gender='F'>
<parent> m2 </parent>
<personal>
<income>40000</income>
</personal>
</daughter>
<son id = 'm5' name = 'Jim' gender='M'>
<parent> m2 </parent>
<personal>
<income>35000</income>
</personal>
</son>
<daughter id = 'm6' name = 'Megan' gender='F'>
<parent> m2 </parent>
<personal>
<income>30000</income>
</personal>
</daughter>
</family>";
var myXML= XMLData.parse( cXMLDoc, false);
The following line returns an XFAObject.
Get mom’s data.
var a = XMLData.applyXPath(myXML, "//family/mom")
a.saveXML('pretty');
<?xml version="1.0" encoding="UTF-8"?>
<mom id="m3" name="Mary" gender="F">
<spouse> m2 </spouse>
<personal>
<income>25000</income>
</personal>
</mom>
// get the income element value
a.personal.income.value = "20000"; // change the income
Get dad’s name, an attribute.
var b = XMLData.applyXPath(myXML, "//family/dad/@name");
b.saveXML('pretty');
<?xml version="1.0" encoding="UTF-8"?>
name="Bob"
// assign to a variable
var dadsName = b.value; // dadsName = "Bob"
Get all attributes of dad node.
var b = XMLData.applyXPath( myXML, "//family/dad/attribute::*" );
for(var i=0; i < b.length; i++)
console.println(b.item(i).saveXML('pretty'))
The loop above outputs the following to the console.
<?xml version="1.0" encoding="UTF-8"?>
id="m2"
<?xml version="1.0" encoding="UTF-8"?>
name="Bob"
<?xml version="1.0" encoding="UTF-8"?>
gender="M"
Extract particular information from this
console.println("For attribute 2, we have " + b.item(2).name + " = '"
+ b.item(2).value + "'.");
which yields an output of
For attribute 2, we have gender = 'M'.
Get dad’s second child.
var c = XMLData.applyXPath(myXML, "//family/dad/child[position()=2]");
c.saveXML('pretty')
<?xml version="1.0" encoding="UTF-8"?>
<child> m5 </child>
This is the id of dad’s second child. The examples below get the family data on this child.
The following returns a string.
// Calculate the value of dadsName using XPath methods.
var dadsName = XMLData.applyXPath(myXML, "string(//family/dad/@name)")
// dadsName is assigned a value of "Bob" with this one line.
Get the family information on dad’s second child. The following line assigns c = "m5". The return value of the call to applyXPath is a string, and the function normalize-space converts its argument to a string and removes any surrounding spaces.
var c = XMLData.applyXPath(myXML,
"normalize-space(//family/dad/child[2])");
var d = "//*[@id = '" + c + "']"; // Note: d= "//*[@id = 'm5']"
XMLData.applyXPath(myXML, d ).saveXML('pretty'); // show what we have
<son id="m5" name="Jim" gender="M">
<parent> m2 </parent>
<personal>
<income>35000</income>
</personal>
</son>
Now display information about the sixth child node of the family root. The XPath functions name and concat are used.
var e = XMLData.applyXPath(myXML,
"concat(name(//family/child::*[position()=6]), '=',
//family/child::*[position()=6]/@name)" );
console.println(e); // the output is "daughter=Megan"
Get the names of all members of the “Robat” family.
e = XMLData.applyXPath(myXML,"//family/child::*" );
for ( var i = 1; i <= e.length; i++ ) {
var str = "string(//family/child::*["+i+"]/@name)";
console.println(XMLData.applyXPath(myXML,str));
}
The output is
A.C.
Bob
Mary
Sue
Jim
Megan
The following code shows a Boolean return value.
var f = XMLData.applyXPath( myXML, "//family/dad/@id = 'm2'" );
if ( f == true ) console.println("dad's id is 'm2'");
else console.println("dad's id is not 'm2'");
The following code shows a numeric return value.
// Get dad's income
g = XMLData.applyXPath( myXML, "number(//family/dad/personal/income)" );
// Double dad's salary, implied conversion to a number type
console.println("Dad's double salary is " +
XMLData.applyXPath( myXML, "//family/dad/personal/income * 2" ) );
Now compute the total income of the family “Robat”.
console.println("Total income of A.C. Robat's family is "
+ XMLData.applyXPath( myXML, "sum(//income)" ) + ".");
The above line writes the following to the console.
Total income of A.C. Robat's family is 305000.
List the individual incomes.
var g = XMLData.applyXPath( myXML, "//income")
for ( var i =0; i< g.length; i++) console.println(g.item(i).value);
data-id=63609
data-id=parse
data-id=id1112
parse
Creates an object representing an XML document tree. Its parameters are the same as those of the loadXML method in the XFA Data DOM.
This method returns an object of type XFA object that represents either a tree headed by a single node or a tree started by a list of nodes (a tree list).
Parameters
param1param2true. If false, the root node should not be ignored.Returns
XFAObject
Example 1: Consider the XML document as first introduced in the example following the XMLData. applyXPath method.
var x = XMLData.parse( cXMLDoc, false );
var y = x.family.name; // An XFAObject
console.println(y.value); // Output to console is "Robat"
Get information about dad.
y = x.family.dad.id; // An XFAObject
console.println(y.value); // Output to console is "m2"
y = x.family.dad.name.value; // y = "Bob"
x.family.dad.name.value = "Robert"; // Change name to "Robert"
y = x.family.dad.name.value; // y = "Robert"
y = x.family.dad.personal.income.value; // y = "75000"
x.family.dad.personal.income.value = "80000";// Give dad a raise
Example 2: Create a simple XML document and manipulate it.
x = XMLData.parse("<a> <c>A.</c><d>C.</d> </a>, false);
x.saveXML("pretty");
The output of the previous line is
<?xml version="1.0" encoding="UTF-8"?>
<xfa:data xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">
<a>
<c>A.</c>
<d>C.</d>
</a>
</xfa:data>
Now create another simple document.
y = XMLData.parse("<b>Robat</b>", false);
y.saveXML("pretty");
The output of this line
<?xml version="1.0" encoding="UTF-8"?>
<xfa:data xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">
<b>Robat</b>
</xfa:data>
Append y on to x.
x.nodes.append(y.clone(true).nodes.item(0));
x.saveXML("pretty");
The result:
<?xml version="1.0" encoding="UTF-8"?>
<xfa:data xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">
<a>
<c>A.</c>
<d>C.</d>
</a>
<b>Robat</b>
</xfa:data>
Now execute
x.nodes.insert(y.clone(true).nodes.item(0), x.nodes.item(0));
x.saveXML("pretty")
to obtain
<?xml version="1.0" encoding="UTF-8"?>
<xfa:data xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">
<b>Robat</b>
<a>
<c>A.</c>
<d>C.</d>
</a>
<b>Robat</b>
</xfa:data>
Now remove these two nodes.
x.nodes.remove( x.nodes.namedItem("b") );
x.nodes.remove( x.nodes.namedItem("b") );
Now, we are back to the original XML document.
<?xml version="1.0" encoding="UTF-8"?>
<xfa:data xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">
<a>
<c>A.</c>
<d>C.</d>
</a>
</xfa:data>
Executing the following line
x.a.nodes.insert( y.clone(true).nodes.item(0), x.a.nodes.item(0));
x.saveXML("pretty");
yields the following output:
<?xml version="1.0" encoding="UTF-8"?>
<xfa:data xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">
<a>
<b>Robat</b>
<c>A.</c>
<d>C.</d>
</a>
</xfa:data>
Now remove that node just inserted.
x.a.nodes.remove( x.a.nodes.namedItem("b"));
Now insert y (actually a clone of y) between the first and second children of the element a.
x.a.nodes.insert( y.clone(true).nodes.item(0), x.a.nodes.item(1));
This produces the following
<?xml version="1.0" encoding="UTF-8"?>
<xfa:data xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">
<a>
<c>A.</c>
<b>Robat</b>
<d>C.</d>
</a>
</xfa:data>
Remove that node just inserted:
x.a.nodes.remove( x.a.nodes.namedItem("b"));
Finally, append y onto a.
x.a.nodes.append( y.clone(true).nodes.item(0));
yielding
<?xml version="1.0" encoding="UTF-8"?>
<xfa:data xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">
<a>
<c>A.</c>
<d>C.</d>
<b>Robat</b>
</a>
</xfa:data>