setImage Method |
Sets the image used by this ImageShape.
function setImage(key);
key
Type: String Object data key for use with a PdfIntegrationProvider which implements the ProcessObjectDataRequest method; or a data URL (e.g. "data:image/png;base64,iVBO..."); or another PdfObject which has an image (e.g. a ImageShape)Type: Boolean
true if operation is started successfully; otherwise, false.If this PdfObject is not an ImageShape, this method will always return false.
This method does not immediately set the image as sending the key to the server, processing it, and applying it to the object requires a server request. To check if an image has been applied, use the hasImage Method.Add a new image object to the first page:
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 more information) 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);