Method ImportDataObject

Namespace TallComponents.PDF.JavaScript.Scripting
Class Doc

Imports an external file into the document and associates the specified name with the data object. Data objects can later be extracted or manipulated. When a file attachment is imported using importDataObject, the value of its Data.name is assigned by the parameter cName.

By default, this method will try to embed a file to the document from the given path. If this fails, it will return false.

In order to provide an implementation that adheres to the PDF specification, one should override this method and test whether path contains a valid file path. If not, invoke base.ImportAnFDF(name, path, cryptFilter) by setting the path variable.

Please note, that the path variable must be provided in a device-independent form, e.g. 'c:\path\to\file.ext' must be provided in the way of '/c/path/to/file.ext'

Syntax

protected internal  Boolean  ImportDataObject( String  name String  path String  cryptFilter )

Returns

Boolean

true on success. An exception is thrown on failure.

Parameters


String name
The name to associate with the data object.

String path
(optional) A device-independent path to a data file on the user’s hard drive. This path may be absolute or relative to the current document. If not specified, the user is prompted to locate a data file.

String cryptFilter
(optional, Acrobat 6.0) The language-independent name of a crypt filter to use when encrypting this data object. This crypt filter must have previously been added to the document’s list of crypt filters, using the Doc addRecipientListCryptFilter method, otherwise an exception will be thrown. To leave this data object unencrypted in a file that is encrypted by the Doc encryptForRecipients method, the predefined Identity crypt filter can be used.