open


Purpose

Opens the document.

Signature

open( url, options, callbacks )

Returns

This method does not return anything.

Parameters

Name Description Type Use
url

A URL address of the file. The API supports both http(s) and filesystem URL schemes.

string required
options Configuration passed to the function call. object optional
callbacks Passed to verify whether there is an external application that can open that particular file type. undefined required

The open method's options object looks like in the following example.

{ mimeType, preview, previewRect, timeout, authenticationType, username, password }
Name Description Type Use
mimeType A MIME type of the file. If not provided, the function will try to determine the file type automatically. In case of iOS the MIME type will be converted to UTI. string optional
preview If set to true, the function will try to display a ful-screen preview of the file. This property is supported on iOS only and its default value is "false". boolean optional
previewRect

Defines a rectangle from which the dialog popover should be presented. Optional, supported on iPad only. If not provided, the popover will be presented from the bottom edge of the screen.

The previewRect's configuration object contains the following parameters:

{ x, y, width, height }
optional
timeout A server response timeout (in seconds). It is used only if http(s)-based URL address has been specified. The default value of this property is "60". integer optional
authenticationType Specifies the function's behavior when HTTP basic authentication is requested. The setting's default value is "AUTHENTICATION_ANONYMOUS". Other possible settings are listed in the Constants section of the DocumentViewer article. string optional
username An optional username used when HTTP basic authentication is requested. The value is passed only if authenticationType is set to "AUTHENTICATION_CUSTOM_CREDENTIALS". string optional
password An optional passoword used when HTTP basic authentication is requested. The value is passed only if authenticationType is set to "AUTHENTICATION_CUSTOM_CREDENTIALS". string optional

The open method's callbacks object can be structured as follows:

{
  onProgress: function(progress) {...},
  onSuccess: function() {...},
  onFailure: function(error) {...}
}

The table below lists all callbacks supported by the method.

Name Description Return type
onProgress Called when the download progress is updated. Used for http(s)-based downloads only. The progress parameter passed in this callback consists of a double value between 0.0 (start) and 1.0 (finish), indicating the current progress of opening a document. undefined
onSuccess On iOS, it is called when the document successfully closes. On Android, it is called when the document successfully launches. undefined
onFailure

Called when an error occurs.

The error object contains two fields: code (a numeric value associated with an error) and description (the type of failure). Possible failure types are listed in the Constants table, found in the DocumentViewer article.

undefined

Related topics

DocumentViewer
Legal notice | Copyright © 2019 and Confidential to Pegasystems Inc. All rights reserved
Pega Community | Feedback
Advanced...