Click or drag to resize

getObject Method

Gets an object on this page of the currently loaded document.

Syntax
JavaScript
function getObject(index);

Parameters

index

Type: Integer

The zero-based index of an object in this PdfPage Class.

Return Value

Type: PdfObject Class

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

Remarks

The index provided must be greater than or equal to 0 and less than getObjectCount Method.

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

//get this page
var page = myApi.getPageViewed();

//get the number of objects on this page
var objCount = page.getObjectCount();

//iterate through all objects on this page
for(var i = 0; i < objCount; i++)
{
    //get this object
    var obj = page.getObject(i);

    //if it is a form field, display its name to the user
    if(obj.isFormField())
    {
        window.alert("Found a form field with the name: " + obj.getProperties()["name"]);
    }
}
See Also