Click or drag to resize

hasImage Method

Gets a value indicating whether this ImageShape has an image.

Syntax
JavaScript
function hasImage();

Parameters

None

Return Value

Type: Boolean

true if this PdfObject is of ImageShape type and it has an image set; otherwise, false.

Remarks

If this PdfObject is not an ImageShape, this method will always return false.

Examples

Add a new image object to the first page:

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

//Add object
var newImage = myApi.getPage(1).addObject(myApi.ObjectType.ImageShape);

//Set image for object using key (see Easy-Integration.aspx sample for )
newImage.setImage("signature");

//As setImage() does not immediately set the image, we can check that the image was set in 1 second
window.setTimeout(function(){ if(!newImage.hasImage()) {window.alert("Image was not set!");} }, 1000);
See Also