I need to capture the customer signature from Html5 Canvas and display it in a Output label. Can anyone please help me out in this?
<div data-role="page" id="signatureCaptureHome" style="over-flow:auto; width:10px; height:10px" >
<div data-role="content" id="content">
<canvas id="signatureCanvas" height="50px" width="550px" style= "border:1px solid black" />
<apex:outputLabel style="font-weight:Bold" value="{! signatureCanvas}"/>
</div>
</div>
@RemoteAction
global static String signatureCanvas(String signatureBody, String parentId) {
try{
system.debug('Record Id == ' + parentId);
system.debug(signatureBody);
Attachment a = new Attachment();
a.ParentId = parentId;
a.Body = EncodingUtil.base64Decode(signatureBody);
a.ContentType = 'image/png';
a.Name = 'Signature Capture.png';
insert a;
return '{success:true, attachId:' + a.Id + '}';
}catch(Exception e){
return JSON.serialize(e);
}
return null;
}