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

Visuel de l'image

This commit is contained in:
Vincent LAURENT 2021-09-20 23:11:05 +02:00
parent c563595bd2
commit cc05e9d838
2 changed files with 7 additions and 2 deletions

View File

@ -46,6 +46,8 @@ loadingTask.promise.then(function(pdf) {
xhr.onreadystatechange = function () {
svgImage = "data:image/svg+xml;base64,"+btoa(this.responseText);
document.getElementById('radio_signature_image').checked = true;
document.getElementById('img-upload').src = svgImage;
document.getElementById('img-upload').classList.remove("d-none");
};
xhr.send( data );
@ -114,7 +116,7 @@ loadingTask.promise.then(function(pdf) {
}
if(document.getElementById('radio_signature_text_classic').checked) {
var textSignature = new fabric.Text(document.getElementById('input-signature-text-classic').value);
var textSignature = new fabric.Text(document.getElementById('input-signature-text-classic').value, { fontSize: 16 });
textSignature.top = y - (textSignature.getScaledHeight() / 2);
textSignature.left = x - (textSignature.getScaledWidth() / 2);
canvasEdition.add(textSignature).renderAll();

View File

@ -28,7 +28,10 @@
<hr />
<div class="form-check form-switch float-end"><input class="form-check-input" type="radio" name="radio_signature" id="radio_signature_image"></div>
<h5><i class="bi bi-image"></i> Image</h5>
<form id="form-image-upload" action="/image2svg" method="POST" class="row g-3" enctype="multipart/form-data">
<div class="text-center">
<img id="img-upload" style="max-height: 80px" src="" />
</div>
<form id="form-image-upload" action="/image2svg" method="POST" enctype="multipart/form-data">
<input id="input-image-upload" class="form-control" name="image" type="file">
</form>
<hr />