1
0
mirror of https://github.com/24eme/signaturepdf.git synced 2023-08-25 09:33:08 +02:00

Text classique

This commit is contained in:
Vincent LAURENT 2021-09-20 10:05:27 +02:00
parent ea98ee5bd9
commit 6d50b1a87e
2 changed files with 16 additions and 1 deletions

View File

@ -23,6 +23,10 @@ loadingTask.promise.then(function(pdf) {
document.getElementById('radio_signature_text').checked = true;
});
document.getElementById('input-signature-text-classic').addEventListener('keypress', function(event) {
document.getElementById('radio_signature_text_classic').checked = true;
});
var svgImage = null;
document.getElementById('input-image-upload').addEventListener('change', function(event) {
@ -102,6 +106,13 @@ loadingTask.promise.then(function(pdf) {
textSignature.left = x - (textSignature.getScaledWidth() / 2);
canvasEdition.add(textSignature).renderAll();
}
if(document.getElementById('radio_signature_text_classic').checked) {
var textSignature = new fabric.Text(document.getElementById('input-signature-text-classic').value);
textSignature.top = y - (textSignature.getScaledHeight() / 2);
textSignature.left = x - (textSignature.getScaledWidth() / 2);
canvasEdition.add(textSignature).renderAll();
}
});
canvasEditions.push(canvasEdition);

View File

@ -23,7 +23,7 @@
<canvas id="signature-pad" class="border bg-light" width=200 height=150></canvas>
<hr />
<div class="form-check form-switch float-end"><input class="form-check-input" type="radio" name="radio_signature" id="radio_signature_text"></div>
<h5><i class="bi bi-fonts"></i> Texte</h5>
<h5><i class="bi bi-fonts"></i> Texte à la main</h5>
<input id="input-text-signature" type="text" class="form-control" placeholder="Ma signature" style="font-family: 'Caveat', cursive; font-size: 24px;" />
<hr />
<div class="form-check form-switch float-end"><input class="form-check-input" type="radio" name="radio_signature" id="radio_signature_image"></div>
@ -32,6 +32,10 @@
<input id="input-image-upload" class="form-control" name="image" type="file">
</form>
<hr />
<div class="form-check form-switch float-end"><input class="form-check-input" type="radio" name="radio_signature" id="radio_signature_text_classic"></div>
<h5><i class="bi bi-type"></i> Texte classique</h5>
<input id="input-signature-text-classic" type="text" class="form-control" placeholder="" />
<hr />
<p><small class="text-muted"><i class="bi bi-hand-index"></i><i class="bi bi-hand-index"></i> Double-cliquer sur le PDF pour <i class="bi bi-plus-circle-fill"></i> ajouter la signature</small></p>
<form id="form_pdf" action="/<?php echo $key ?>/save" method="post">
<div class="position-fixed bottom-0 mb-2">