Click or drag to resize

addObject Method

Adds a new object to this page of the currently loaded document.

Syntax
JavaScript
function addObject(objType, left, top, width, height);

Parameters

objType

Type: ObjectType Enumeration

The type of object to add to this page.

left

Type: Integer

The left coordinate of the new object.

top

Type: Integer

The top coordinate of the new object.

width

Type: Integer

The width of the new object.

height

Type: Integer

The height of the new object.

Return Value

Type: PdfObject Class

A new PdfObject Class instance if operation completed successfully; otherwise, null.

Remarks

If the DocumentSettings for this document prohibit the creation of this object type, null will be returned.

At this time, SignatureField objects can not be created with this method. Because PopupAnnotation objects can not exist without a parent markup annotation (like a TextAnnotation), they can not be created with this method.

Examples
JavaScript
var myApi = new PdfWebControlApi("PdfWebControl1"); // where "PdfWebControl1" is the ID (ClientID) assigned to the PdfWebControl instance

//add a new circle object to the current page
var o = myApi.getPageViewed().addObject(myApi.ObjectType.EllipseShape, 10, 10, 100, 100);

//set that new object is not movable
o.setProperties({"movable" : false});
See Also

Other Resources