Doc properties

alternatePresentations

external

mouseX

securityHandler

author

filesize

mouseY

selectedAnnots

baseURL

hidden

noautocomplete

sounds

bookmarkRoot

hostContainer

numFields

spellDictionaryOrder

calculate

icons

numPages

spellLanguageOrder

collection

info

numTemplates

subject

creationDate

innerAppWindowRect

path

templates

creator

innerDocWindowRect

outerAppWindowRect

title

dataObjects

isModal

outerDocWindowRect

URL

delay

keywords

pageNum

viewState

dirty

layout

pageWindowRect

xfa

disclosed

media

permStatusReady

XFAForeground

docID

metadata

producer

zoom

documentFileName

modDate

requiresFullSave

zoomType

dynamicXFAForm

 

 

 

alternatePresentations

6.0

 

 

 

References the document's AlternatePresentation object. If the functionality needed to display alternate presentations is not available, this property is undefined.

The AlternatePresentation object provides access to the document's alternate presentations. The PDF language extension specifies that each document can potentially have many named alternate presentations. Each alternate presentation with a known type will have a corresponding alternatePresentations property in the document. This property should have the same name as its alternate presentation and should reference its alternate presentation's AlternatePresentation object. If there are no recognized alternate presentations in the document, this object is empty (does not have any properties).

The PDF Reference provides details on alternate presentations.

Note:For compatibility with the current implementation, the alternate presentation name must be an ASCII string. The only alternate presentation type currently implemented is “SlideShow”.

See the AlternatePresentation object for properties and methods that can be used to control an alternate presentation.

Type

Object | undefined

Access

R

Example 1

Test whether the AlternatePresentation object is present:

   if( typeof this.alternatePresentations != "undefined" )

   {

      // Assume AlternatePresentations are present

      // List the names of all alternate presentations in the doc

      for ( var ap in this.alternatePresentations ) console.println(ap);

   }

Example 2

Get the slide show named MySlideShow and start the show.

   // oMySlideShow is an AlternatePresentation object

   oMySlideShow = this.alternatePresentations["MySlideShow"];

   oMySlideShow.start();

author

X 

D 

 

 

Note:This property has been superseded by the info property.

The author of the document.

Type

String

Access

R/W (Adobe Reader: R only)

baseURL

5.0

D 

 

 

The base URL for the document is used to resolve relative web links within the document. See also URL.

Type

String

Access

R/W

Example

Sets the base URL and creates a link to go to a page relative to the base URL.

   console.println("Base URL was " + this.baseURL);

   this.baseURL = "http://www.example.com/products/";

   console.println("Base URL is " + this.baseURL);

   // Add a link to the first page

   var link = this.addLink(0, [200,200, 400, 300])

   // Set an action that goes to the Example Reader page on the Example website.

   link.setAction("this.getURL('reader',false)")

bookmarkRoot

5.0

 

 

 

The root bookmark for the bookmark tree. This bookmark is not displayed to the user but is a programmatic construct used to access the tree and the child bookmarks.

Type

Object

Access

R

Example

See the Bookmark object for an example.

calculate

4.0

 

 

 

If true (the default value), calculations can be performed for this document. If false, calculations cannot be performed for this document. This property supersedes the app.calculate property, whose use is now discouraged.

Type

Boolean

Access

R/W

collection

9.0

 

 

 

The value of the collection property is a Collection object of the collection in this PDF. Properties of the collection may be changed through the Collection object.

Note:A PDF file cannot be converted into a PDF collection. The attribute of a document as a PDF collection cannot be removed.

If a new collection is desired, use app.newCollection.

Type

Collection object or a null object if there is no collection in this PDF.

Access

R

Example

if (this.collection) {

  var collection = this.collection;

  // Do something with the collection...

}

creationDate

X 

 

 

 

Note:This property has been superseded by the info property.

The document’s creation date.

Type

Date

Access

R

creator

X 

 

 

 

Note:This property has been superseded by the info property.

The creator of the document (for example, “Adobe FrameMaker” or “Adobe PageMaker”).

Type

String

Access

R

dataObjects

5.0

 

 

 

An array containing all the named Data objects in the document.

Related properties and methods are openDataObject, getDataObject, createDataObject, importDataObject, removeDataObject, getDataObjectContents, and setDataObjectContents.

Type

Array

Access

R

Example

List all embedded files in the document.

   var d = this.dataObjects;

   for (var i = 0; i < d.length; i++)

      console.println("Data Object[" + i + "]=" + d[i].name);

delay

4.0

 

 

 

This property can delay the redrawing of any appearance changes to every field in the document. It is generally used to buffer a series of changes to fields before requesting that the fields regenerate their appearance. If true, all changes are queued until delay is reset to false, at which time all the fields on the page are redrawn.

See also the Field object delay property.

Type

Boolean

Access

R/W

dirty

3.01

D 

 

X 

Specifies whether the document needs to be saved as the result of a changes to the document. It is useful to reset the dirty flag when performing changes that do not warrant saving, such as updating a status field.

Note:If the document is temporary or newly created, setting dirty to false has no effect. That is, the user is still asked to save changes before closing the document. See requiresFullSave.

Type

Boolean

Access

R/W

Example 1

Reset a form and sets dirty to false. After the reset, the user can close the document without having to dismiss a Save dialog box.

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

   f.value = "You have made too many mistakes, I’m resetting the form. "

      + "Start over, this time follow the directions!";

   this.resetForm();

   this.dirty = false;

Example 2

Fill a text field to instruct the user to complete the form. The script is constructed so that populating the field does not change the save state of the document.

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

   var b = this.dirty;

   f.value = "Please fill in the fields below.";

   this.dirty = b;

disclosed

5.05

 

S 

 

Specifies whether the document should be accessible to JavaScript scripts in other documents.

The app.openDoc and app.activeDocs methods check the disclosed property of the document before returning its Doc.

Note:The disclosed property can only be set during batch, console, Page/Open and Doc/Open events. See the event object for a discussion of JavaScript events. See also Privileged versus non-privileged context.

Type

Boolean

Access

R/W

Example 1

A document can be disclosed to others by placing the code at the document level (or as a page open action) at the top level:

   this.disclosed = true;

Example 2

The following code can be used in an Execute JavaScript Batch Sequence to disclose all selected documents.

   this.addScript("Disclosed", "this.disclosed = true;");

docID

6.0

 

 

 

An array of two strings in hex-encoded binary format. The first string is a permanent identifier based on the contents of the file at the time it was originally created; it does not change when the file is incrementally updated. The second string is a changing identifier based on the file’s contents at the time it was last updated. These identifiers are defined by the optional ID entry in a PDF file’s trailer dictionary. (See the PDF Reference.)

Type

Array

Access

R

See Example 6 (Acrobat 7.0) for an example of usage.

documentFileName

6.0

 

 

 

The base file name, with extension, of the document referenced by the Doc. The device-independent path is not returned. See also the path and URL properties. The file size of the document can be obtained from the filesize property.

Type

String

Access

R

Example

Get the document file name.

   console.println('"The file name of this document is '

      + this.documentFileName +'."');

Executing the script on this document, the JavaScript for Acrobat API Reference, yields the following statement:

   "The file name of this document is js_api_reference.pdf"

dynamicXFAForm

7.0

 

 

 

Returns true if the document is a dynamic XFA form and false otherwise.

A dynamic XFA form is one in which some of the fields can grow or shrink in size to accommodate the values they contain.

Type

Boolean

Access

R

Example

See the XFA object for an example of usage.

external

4.0

 

 

 

Specifies whether the current document is being viewed in the Acrobat application or in an external window (such as a web browser).

Type

Boolean

Access

R

Example

Detect whether this document is in a browser or not.

   if ( this.external )

   {

      // Viewing from a browser

   }

   else

   {

      // Viewing in the Acrobat application.

   }

filesize

3.01

 

 

 

The file size of the document in bytes.

Type

Integer

Access

R

Example (Acrobat 5.0)

Get a readout of the difference in file sizes before and after saving a document:

   // Add the following code to the "Document Will Save" section

   var filesizeBeforeSave = this.filesize

   console.println("File size before saving is " + filesizeBeforeSave);

   

   // Add the following code to the "Document Did Save" section

   var filesizeAfterSave = this.filesize

   console.println("File size after saving is " + filesizeAfterSave);

   var difference = filesizeAfterSave - filesizeBeforeSave;

   console.println("The difference is " + difference );

   if ( difference < 0 )

      console.println("Reduced filesize!");

   else

      console.println("Increased filesize!");

 

hidden

7.0

 

 

 

This property is true if the document’s window is hidden. A window may be hidden, for example, because it is being operated on in batch mode or if it was explicitly opened hidden. The openDataObject and app.openDoc methods can be used to open a document with a hidden window.

Type

Boolean

Access

R

Example

Open a document and verify its hidden status.

   oDoc = app.openDoc({

      cPath:"/C/myDocs/myHidden.pdf",

      bHidden: true

   });

   console.println("It is " + oDoc.hidden + " that this document hidden.");

   oDoc.closeDoc();

hostContainer

7.0.5

 

 

 

An instance of the HostContainer object if the PDF document is embedded in another container such as a web browser, otherwise undefined.

Note:This property is not implemented on the Mac OS platform.

Type

Object

Access

R/W

icons

5.0

 

 

 

An array of named Icon objects that are present in the document-level named icons tree. If there are no named icons in the document, the property has a value of null.

See also addIcon, getIcon, importIcon, removeIcon, the Field object properties buttonGetIcon, buttonImportIcon, buttonSetIcon, and the Icon object.

Type

Array | null

Access

R

Example 1

Report the number of named icons in the current document.

   if (this.icons == null)

      console.println("No named icons in this doc");

   else

      console.println("There are " + this.icons.length

         + " named icons in this doc");

Example 2

List all named icons the current document.

   for (var i = 0; i < this.icons.length; i++) {

      console.println("icon[" + i + "]=" + this.icons[i].name);

   }

info

5.0

D 

 

 

Specifies an object with properties from the document information dictionary in the PDF file. (See the PDF Reference). Standard entries are:

   Title

   Author

   Authors                     (Acrobat 9.0)

   Subject

   Keywords

   Creator

   Producer

   CreationDate

   ModDate

   Trapped

For Acrobat, properties of this object are writeable and setting a property dirties the document. Additional document information fields can be added by setting non-standard properties.

In Adobe Reader, writing to any property in this object throws an exception.

Note:Standard entries are case insensitive, that is, info.Keywords is the same as info.keywords.

Acrobat 9.0 intoduces the Authors (authors) property of the info object. Use Authors to retrieve a seim-colon delimited list of authors. Author information is saved in the XMP metadata, and Doc.info.Authors retrieves the information from the metadata as an array. Individual authors can be accessed. See Example 3 (Acrobat 9.0) below.

Type

Object

Access

R/W (Adobe Reader: R only)

Example 1

Get the title of the current document.

   var docTitle = this.info.Title;

Example 2

Get information about the document.

   this.info.Title = "JavaScript, The Definitive Guide";

   this.info.ISBN = "1-56592-234-4";

   this.info.PublishDate = new Date();

   for (var i in this.info)

      console.println(i + ": "+ this.info[i]);

The above script could produce the following output:

   CreationDate: Mon Jun 12 14:54:09 GMT-0500 (Central Daylight Time) 2000

   Producer: Acrobat Distiller 4.05 for Windows

   Title: JavaScript, The Definitive Guide

   Creator: FrameMaker 5.5.6p145

   ModDate: Wed Jun 21 17:07:22 GMT-0500 (Central Daylight Time) 2000

   SavedBy: Adobe Acrobat 4.0 Jun 19 2000

   PublishDate: Tue Aug 8 10:49:44 GMT-0500 (Central Daylight Time) 2000

   ISBN: 1-56592-234-4

Example 3 (Acrobat 9.0)

This example demonstrates how to set and to get multiple authors. Multiple authors may also be entered through the Description tab of the Document Properties dialog box.

Set three authors for this document.

this.info.Authors=["Robat, A. C.", "Obe, A. D.","Torys, D. P."];

Execute this.info.Authors in the JavaScript Debugger Console window, the result is given below.

Robat, A. C.,Obe, A. D.,Torys, D. P.

Get each of the authors.

for (var i=0; i<this.info.Authors.length; i++)

   console.println((i+1) + ": " + this.info.Authors[i]);

The result ,as reported in the Console window, is given below.

1: Robat, A. C.

2: Obe, A. D.

3: Torys, D. P.

innerAppWindowRect

6.0

 

 

 

This property returns an array of screen coordinates (a rectangle) for the Acrobat inner application window. This rectangle does not include items such as the title bar and resizing border, which are part of the outer rectangle of the application window.

Type

Array of Numbers

Access

R

Example

Read back to the console the Acrobat inner application window.

   var coords = this.innerAppWindowRect;

   console.println(coords.toSource())

   // Possible output: [115, 154, 1307, 990]

See also innerDocWindowRect, outerAppWindowRect and outerDocWindowRect.

innerDocWindowRect

6.0

 

 

 

This property returns an array of screen coordinates (a rectangle) for the Acrobat inner document window. This rectangle does not include items such as the title bar and resizing border, which are part of the outer rectangle of the document window.

The document and application rectangles may differ on different platforms. For example, on Windows, the document window is always inside the application window; on Mac OS, they are the same.

Type

Array of Numbers

Access

R

See also innerAppWindowRect, outerAppWindowRect, outerDocWindowRect, and pageWindowRect.

isModal

7.0.5

 

 

 

A Boolean value indicating whether the document is currently in a modal state (for example, displaying a modal dialog box using app.execDialog).

Type

Object

Access

R

keywords

X 

D 

 

 

Note:This property has been superseded by the info property.

The keywords that describe the document (for example, “forms”, “taxes”, “government”).

Type

Object

Access

R/W (Adobe Reader: R only)

layout

5.0

 

 

 

Changes the page layout of the current document. Valid values are:

   SinglePage

   OneColumn

   TwoColumnLeft

   TwoColumnRight

In Acrobat 6.0 and later, there are two additional properties:

   TwoPageLeft

   TwoPageRight

Type

String

Access

R/W

Example

Put the document into a continuous facing layout where the first page of the document appears in the left column:

   this.layout = "TwoColumnLeft";

media

6.0

 

 

 

An object that contains multimedia properties and methods for the document. The properties and methods are described under the Doc.media object.

Type

Doc.media object

Access

R/W

metadata

6.0

D 

 

X 

Allows you to access the XMP metadata embedded in a PDF document. Returns a string containing the metadata as XML. For information on embedded XMP metadata, see the PDF Reference.

Type

String

Access

R/W

Exceptions

RaiseError is thrown if setting metadata to a string not in XMP format.

Example 1

Try to create metadata not in XMP format.

   this.metadata = "this is my metadata";

   RaiseError: The given metadata was not in the XMP format

   Global.metadata:1:Console undefined:Exec

    ===> The given metadata was not in the XMP format

Example 2

Create a PDF report file with metadata from a document.

   var r = new Report();

   r.writeText(this.metadata);

   r.open("myMetadataReportFile");

Example 3

(Acrobat 8.0) This example illustrates how to use E4X to change the metadata of the document. The script sets the Copyright Status, the Copyright Notice and the Copyright Info URL fields. The script can be executed from the console or as a batch sequence.

   var CopyrightStatus = "True";

   var CopyrightNotice = "Copyright(C) 2006, Example Systems, Inc."

   var CopyrightInfoURL = "http://www.example.com"

   var meta = this.metadata;

   var myXMPData = new XML(meta);

   myx = new Namespace("adobe:ns:meta/");

   myrdf = new Namespace("http://www.w3.org/1999/02/22-rdf-syntax-ns#");

   mypdf = new Namespace("http://ns.adobe.com/pdf/1.3/");

   myxap = new Namespace("http://ns.adobe.com/xap/1.0/");

   mydc = new Namespace("http://purl.org/dc/elements/1.1/");

   myxapRights = new Namespace("http://ns.adobe.com/xap/1.0/rights/");

   var p = myXMPData.myrdf::RDF.myrdf::Description;

   /*

      We test whether this element has a value already, if no, we assign it a
      value, otherwise we assign it another value.

   */

   if (p.mydc::rights.myrdf::Alt.myrdf::li.toString() == "") {

      p[0] +=  <rdf:Description rdf:about=""

         xmlns:dc="http://purl.org/dc/elements/1.1/"

         xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">

         <dc:rights>

            <rdf:Alt>

               <rdf:li xml:lang="x-default">

                  {CopyrightNotice}

               </rdf:li>

            </rdf:Alt>

         </dc:rights>

      </rdf:Description>

   } else

      p.mydc::rights.myrdf::Alt.myrdf::li = CopyrightNotice;

/*

   Some elements are converted into attributes, so we need to first test

   whether the xapRights:Marked attribute is present, if not, we add it in as an

   element; otherwise, if the attribute is present, we update the attribute.

   Acrobat changes certain elements into attributes; the xapRights:Marked and

   xapRights:WebStatement are two such examples, but dc:rights above is one

   that is not changed into an attribute.

*/

   if (p.@myxapRights::Marked.toString() == "" ) {

      p[0] +=  <rdf:Description rdf:about=""

         xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"

         xmlns:xapRights="http://ns.adobe.com/xap/1.0/rights/">

         <xapRights:Marked>{CopyrightStatus}</xapRights:Marked>

         <xapRights:WebStatement> {CopyrightInfoURL} </xapRights:WebStatement>

      </rdf:Description>

   } else {

      p.@myxapRights::Marked = CopyrightStatus;

      p.@myxapRights::WebStatement = CopyrightInfoURL;

   }

// Convert myXMPData into a string

   myNewXMPStr=myXMPData.toXMLString();

// and assign it to the document metadata

   this.metadata = myNewXMPStr;

modDate

X 

 

 

 

Note:This property has been superseded by the info property.

The date the document was last modified.

Type

Date

Access

R

mouseX

7.0

 

 

 

Gets the x coordinate of the mouse coordinates in default user space in relation to the current page.

Type

Number

Access

R

Example

Get the coordinates of the mouse as the user moves it around the viewer.

   function getMouseCoor() {

      console.println( "("+this.mouseX+","+ this.mouseY+")" );

   }

   var ckMouse = app.setInterval("getMouseCoor()", 100);

   var timeout = app.setTimeOut(

      "app.clearInterval(ckMouse); app.clearTimeOut(timeout)",2000);

mouseY

7.0

 

 

 

Gets the y coordinate of the mouse coordinates in default user space in relation to the current page.

Type

Number

Access

R

noautocomplete

7.0

 

 

 

This property can be used to turn off the auto-complete feature of Acrobat forms, for this document only:

Setting this property does not change the user’s auto-complete preferences.

Initially, this property has a value of undefined.

Type

Boolean

Access

R/W

Example

The following script could be executed from an open page action or as a top-level document JavaScript. It turns off the auto-complete feature:

   this.noautocomplete = true;

numFields

4.0

 

 

 

The total number of fields in the document. See also getNthFieldName.

Type

Integer

Access

R

Example 1

   console.println("There are " + this.numFields + " in this document");

Example 2

This script uses the numFields property and getNthFieldName method to loop through all fields in the document. All button fields are changed so that they have a beveled appearance (other modifications to the buttons of the document can also be made).

   for ( var i = 0; i < this.numFields; i++) {

      var fname = this.getNthFieldName(i);

      if ( fname.type = "button" ) f.borderStyle = border.b;

   }

numPages

3.01

 

 

 

The number of pages in the document.

Type

Integer

Access

R

Example 1

   console.println("There are " + this.numPages + " in this document");

Example 2

Delete the last page from the document. The (0-based) page number of the last page in the document is this.numPages - 1.

   this.deletePages({ nStart: this.numPages - 1 });

numTemplates

X 

 

 

 

Note:This property has been superseded by templates.

The number of templates in the document.

Type

Integer

Access

R

path

3.01

 

 

 

The device-independent path of the document, for example:

   /c/Program Files/Adobe/Acrobat 5.0/Help/AcroHelp.pdf

Type

String

Access

R

The file name of the document can be acquired by the documentFileName property. See also the URL property.

outerAppWindowRect

6.0

 

 

 

This property returns an array of screen coordinates (a rectangle) for the Acrobat outer application window. This rectangle includes items such as the title bar and resizing border, which are not part of the inner rectangle of the application window.

Type

Array of Numbers

Access

R

See also innerAppWindowRect, outerDocWindowRect, outerDocWindowRect, and pageWindowRect.

outerDocWindowRect

6.0

 

 

 

This property returns an array of screen coordinates (a rectangle) for the Acrobat outer document window. This rectangle includes items such as the title bar and resizing border, which are not part of the inner rectangle of the document window.

The application and document rectangles may differ on different platforms. For example, on Windows, the document window is always inside the application window. In Mac OS, the windows are the same.

Type

Array of Numbers

Access

R

See also innerAppWindowRect, outerDocWindowRect, outerAppWindowRect, and pageWindowRect.

pageNum

3.01

 

 

 

Gets or sets the current page of the document. When setting pageNum to a specific page, remember that the values are 0-based.

Type

Integer

Access

R/W

Example

Go to the first page of the document.

   this.pageNum = 0;

Advance the document to the next page.

   this.pageNum++;

pageWindowRect

6.0

 

 

 

An array of screen coordinates (a rectangle) for the Acrobat page view window. The page view window is the area inside the inner document window in which the PDF content is displayed.

Type

Array of Numbers

Access

R

See also innerAppWindowRect, outerDocWindowRect, outerAppWindowRect, and outerDocWindowRect.

permStatusReady

6.0

 

 

 

A Boolean value specifying whether the permissions for this document have been resolved.

When downloading over a network connection, false can indicate that the document is not available, in the case where permissions must be determined based on an certification signature that covers the entire document.

Type

Boolean

Access

R

producer

X 

 

 

 

Note:This property has been superseded by the info property.

The producer of the document (for example, “Acrobat Distiller®” or “PDFWriter”).

Type

String

Access

R

requiresFullSave

7.0

 

 

 

This property is true if the document requires a full save because it is temporary or newly created. Otherwise, it is false.

Type

Boolean

Access

R

Example

   var oDoc = app.newDoc();

   console.println("It is " + oDoc.requiresFullSave

      + " that this document requires a full save.");

securityHandler

5.0

 

 

 

The name of the security handler used to encrypt the document. Returns null if there is no security handler (for example, the document is not encrypted).

Type

String

Access

R

Example

   console.println(this.securityHandler != null ?

      "This document is encrypted with " + this.securityHandler

      + " security." :   "This document is unencrypted.");

This script could print the following if the document was encrypted with the standard security handler.

   This document is encrypted with Standard security.

selectedAnnots

5.0

 

 

C 

An array of Annotation objects corresponding to all currently selected markup annotations.

See also getAnnot and getAnnots.

Type

Array

Access

R

Example

Show all the comments of selected annotations in the console.

   var aAnnots = this.selectedAnnots;

   for (var i=0; i < aAnnots.length; i++)

      console.println(aAnnots[i].contents);

sounds

5.0

 

 

 

An array containing all of the named Sound objects in the document.

See also getSound, importSound, deleteSound, and the Sound object.

Type

Array

Access

R

Example

   var s = this.sounds;

   for (i = 0; i < s.length; i++)

      console.println("Sound[" + i + "]=" + s[i].name);

spellDictionaryOrder

5.0

 

 

 

An array specifying the dictionary search order for this document. For example, the form designer of a medical form may want to specify a medical dictionary to be searched first before searching the user’s preferred order.

The Spelling plug-in first searches for words in this array, then searches the dictionaries the user has selected on the Spelling Preference panel. The user’s preferred order is available from spell.dictionaryOrder. An array of the currently installed dictionaries can be obtained using spell.dictionaryNames.

Note:When setting this property, an exception is thrown if any of the elements in the array is not a valid dictionary name.

Type

Array

Access

R/W

spellLanguageOrder

6.0

 

 

X 

An array specifying the language array search order for this document. The Spelling plug-in first searches for words in this array, then it searches the languages the user has selected on the Spelling Preferences panel. The user’s preferred order is available from spell.languageOrder. An array of currently installed languages can be obtained using the spell.languages property.

Type

Array

Access

R/W

subject

X 

D 

 

 

Note:This property has been superseded by the info property.

The document’s subject. This property is read-only in Adobe Reader.

Type

String

Access

R/W

templates

5.0

 

 

 

An array of all of the Template objects in the document. See also createTemplate, getTemplate, and removeTemplate.

Type

Array

Access

R

Example

List all templates in the document.

   var t = this.templates

   for ( var i=0; i < t.length; i++)

   {

      var state = (t[i].hidden) ? "visible" : "hidden"

      console.println("Template: \"" + t[i].name

         + "\", current state: " + state);

   }

title

X 

D 

 

X 

Note:This property has been superseded by the info property.

The title of the document.

Type

String

Access

R/W (Adobe Reader: R only)

URL

5.0

 

 

 

The document’s URL. If the document is local, it returns a URL with a file:/// scheme for Windows and UNIX and file://localhost/ for Mac OS. This may be different from the baseURL.

Type

String

Access

R

See also the path and documentFileName properties.

viewState

7.0.5

 

 

 

An opaque object representing the current view state of the document. The state includes, at minimum, information about the current page number, scroll position, zoom level, and field focus.

To set this value, you must use what was previously returned from a read of the value. It can be used to restore the view state of a document.

Note:The object is only defined within an embedded PDF.

Type

Object

Access

R/W

Example

This example gets the view state and sends it to the host application, which can store it and pass it back to the viewer later to restore the view to the original state. This code may be executed by a button in the PDF document. The first entry in the array signals the nature of the message to the host.

   if(this.hostContainer)

   {

      cVState = this.viewState.toSource();

      aMsg = new Array( "viewState", cVState );

      this.hostContainer.postMessage(aMsg);

   }

In the host application, the message handler might have this form:

   var cViewState=""; // Variable to save the viewState

   function onMessageFunc( stringArray )

   {

      var PDFObject = document.getElementById( PDFObjectID );

      if ( this != PDFObject.messageHandler )

         alert( "Incorrect this value in onMessage handler" );

      // The first entry in the encoming array is the signal

      var signal = stringArray[0];

 

      switch ( signal ) {

         case "Msg":

            var msgStr = "";

            for ( var i = 1; i < stringArray.length; i++ )

               msgStr += (stringArray[ i ] + "<br>");

            writeMsg( msgStr ); // A function to write to the document.

            break;

 

         case "viewState":

            // View state, let's save this

            cViewState = stringArray[1];

            break;

      }

   }

You can post the value of cViewState back to the embedded PDF using a button. Within the document level JavaScript of the PDF, you might have,

   if ( this.hostContainer )

   {

      myHostContainer = this.hostContainer;

      myHostContainer.messageHandler = {

         onMessage: function(aMessage) {

            var f = this.doc.getField("msg4pdf");

            var strValue = "";

            var signal = aMessage[0];

            switch ( signal ) {

               case "Msg":

                  for(var i = 1; i < aMessage.length; i++)

                     strValue += aMessage[i] + "\r";

                  f.value = strValue;

                  break;

               case "viewState":

                  var restoreViewState = eval( aMessage[1] );  

                  // Reset the viewState, begin sure to acquire the correct

                  // Doc as the doc property of this.

                  this.doc.viewState = restoreViewState;

                  break;

            }

         },

         onError: function(error, aMessage) {

               console.println("error: "+ error.toString())

         },

         onDisclose: HostContainerDisclosurePolicy.SameOriginPolicy,

         allowDeliverWhileDocIsModel: true

      };

      // The this object will be the messageHandler instance that the
      // method is being called on, so we save the Doc as a doc
      // property of the messageHandler instance.

      myHostContainer.messageHandler.doc = this;

   }

xfa

6.0.2

 

 

 

The property is defined only if the document is an XML form, that is, if the document was created in LiveCycle Designer. When defined, xfa is a static XFAObject, which is the root node of the underlying xfa model, and gives access to the xfa scripting object model (SOM).

Refer to the document Adobe XML Form Object Model Reference for details on the xfa SOM. The document Converting Acrobat JavaScript for Use in LiveCycle Designer Forms has a comparison between the Acrobat and LiveCycle Designer scripting object models.

Note:When executing this property from a folder level script, pass the Doc object from the document so that xfa will be executed in the proper context. See Example 2.

Type

XFAObject

Access

R

Example 1

Suppose this document is an XML form, and that there is a text field named EmployeeName. This example uses the xfa object to access and change the value of this field.

   var eN = this.xfa.form.form1.EmployeeName;

   console.println("\nEmployeeName: " + eN.rawValue);

The output to the console is

EmployeeName: A. C. Robat

Now change the value of the EmployeeName.

   eN.rawValue = "Robat, A. C."

   console.println("\nEmployeeName: " + eN.rawValue);

The output to the console is

EmployeeName: Robat, A. C.

The value of the field is changed.

Example 2

Call a function, defined in a folder level script file, that uses the xfa property, by passing the Doc object.

   function isXFA(doc) {

      var wasWasNot = (typeof doc.xfa == "undefined") ? "not" : "";

      console.println("This document was "+wasWasNot+"created by Designer.");

   }

From within the document, or from the console, the function is called is by isXFA(this).

XFAForeground

8.0

 

 

 

Returns true if the document is an XFA Foreground type of form and false otherwise.

Beginning with version 8.0, a PDF file can be imported as artwork into LiveCycle Designer. The possibly rich graphical content of the PDF is used as a background on which form fields can be placed using LiveCycle Designer. The XFAForeground property reports back whether the PDF was created in this way, a value of true means the PDF was imported into LiveCycle Designer as artwork, then saved by LiveCycle Designer.

Type

Boolean

Access

R

Example

This script determines whether the current document is an XFA Foreground type of form, that is, whether it was created by importing a PDF into LiveCycle Designer and saved.

   if ( this.XFAForeground )

      console.println("This is an XFA Foreground form.");

zoom

3.01

 

 

 

The current page zoom level. Allowed values are between 8.33% and 6400%, specified as a percentage number. For example, a zoom value of 100 specifies 100%.

Type

Number

Access

R/W

Example

Zoom to twice the current zoom level.

   this.zoom *= 2;

Set the zoom to 200%.

   this.zoom = 200;

zoomType

3.01

 

 

 

The current zoom type of the document. The table below lists the valid zoom types.

The convenience zoomtype object defines all the valid zoom types and is used to access all zoom types.

Zoom type

Keyword

Version

NoVary 

zoomtype.none 

 

FitPage 

zoomtype.fitP 

 

FitWidth 

zoomtype.fitW 

 

FitHeight 

zoomtype.fitH 

 

FitVisibleWidth 

zoomtype.fitV 

 

Preferred 

zoomtype.pref 

 

ReflowWidth 

zoomtype.refW 

6.0

Type

String

Access

R/W

Example

Set the zoom type of the document to fit the width.

   this.zoomType = zoomtype.fitW;