Signer - Embedded Cloud Signature
Sample to sign documents with Signer in your own app.
by Lacuna Software
HTML
<script src="https://cdn.lacunasoftware.com/libs/signer/lacuna-signer-widget-0.8.0.min.js"></script>
<div style="text-align: center;">
<h1>
Signer embedded Cloud signature
</h1>
<button type="button" onclick="startSignature(this)">
Start Signature for Usuario Teste BIRDID (026.102.470-10)
</button>
</div>
<div id="embed-container" class="frame-container">
</div>
CSS
.frame-container {
position: relative;
width: 100%;
height: 0;
padding-bottom: 56.25%;
}
.frame-responsive {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
border: none;
}
JavaScript
function sign(embedUrl) {
var widget = new LacunaSignerWidget();
widget.on(widget.events.documentSigned, function (e) {
// ...
alert('Document ' + e.id + ' signed');
});
widget.render(embedUrl, 'embed-container');
}
//replace the following function with your own logic to obtain the embed URL
function startSignature(elem) {
elem.innerHTML = 'Loading ...';
$.post("https://demos.lacunasoftware.com/api/signer/embedded?useCloudUser=true", {}).
done(function (data) {
if (data) {
sign(data);
elem.style.visibility = "hidden";
} else {
elem.innerHTML = 'Error';
}
}).fail(function () {
elem.innerHTML = 'Error';
});
}