From 6d50b1a87e4f2a6dcf74c3380e46acf093150381 Mon Sep 17 00:00:00 2001 From: Vincent LAURENT Date: Mon, 20 Sep 2021 10:05:27 +0200 Subject: [PATCH] Text classique --- js/app.js | 11 +++++++++++ pdf.html.php | 6 +++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/js/app.js b/js/app.js index f835420..b81f84b 100644 --- a/js/app.js +++ b/js/app.js @@ -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); diff --git a/pdf.html.php b/pdf.html.php index cc781e7..2f23e97 100644 --- a/pdf.html.php +++ b/pdf.html.php @@ -23,7 +23,7 @@
-
Texte
+
Texte à la main

@@ -32,6 +32,10 @@
+
+
Texte classique
+ +

Double-cliquer sur le PDF pour ajouter la signature