Click or drag to resize

setMode Method

Set the mode currently being used in the PdfWebControl instance.

Syntax
JavaScript
function setMode(mode, key);

Parameters

mode

Type: Mode Enumeration

The mode to activate for use in this PdfWebControl

key

Type: String

Object data key for use with a PdfIntegrationProvider which implements the ProcessObjectDataRequest method.

Not all modes made use of this parameter. At this time, only "InsertImageShape" optionally uses it (if a key is provided, ProcessObjectDataRequest is queried; if not, the client is prompted for upload).

Return Value

Type: Boolean

true if successful; otherwise, false.

Remarks

This method will return false if the mode is invalid.

Examples

Set text selection mode:

JavaScript
var myApi = new PdfWebControlApi("PdfWebControl1"); // where "PdfWebControl1" is the ID (ClientID) assigned to the PdfWebControl instance
myApi.setMode(myApi.Mode.SelectText); //use text selection tool

Activate image tool with server side image:

JavaScript
var myApi = new PdfWebControlApi("PdfWebControl1"); // where "PdfWebControl1" is the ID (ClientID) assigned to the PdfWebControl instance
myApi.setMode(myApi.Mode.InsertImageShape, "myImageKey"); //set image tool using object key which is passed to ProcessObjectDataRequest

Activate image tool with browser upload:

JavaScript
var myApi = new PdfWebControlApi("PdfWebControl1"); // where "PdfWebControl1" is the ID (ClientID) assigned to the PdfWebControl instance
myApi.setMode(myApi.Mode.InsertImageShape); //set image tool
See Also