Click or drag to resize

getObjectCount Method

Gets the number of objects on this page of the currently loaded document.

Syntax
JavaScript
function getObjectCount();

Parameters

None

Return Value

Type: Integer

The number of objects on this page.

Remarks

This method only returns the number of objects on this page. To access objects on a different page, use that page's PdfPage Class.

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