mirror of
https://github.com/24eme/signaturepdf
synced 2024-06-04 23:12:25 +02:00
Signature texte
This commit is contained in:
parent
a433eefc1c
commit
42f29e832c
20
js/app.js
20
js/app.js
|
@ -71,13 +71,23 @@ loadingTask.promise.then(function(pdf) {
|
||||||
if(svgImage) {
|
if(svgImage) {
|
||||||
svg2add = svgImage;
|
svg2add = svgImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(document.getElementById('input-text-signature').value) {
|
||||||
|
var textSignature = new fabric.Text(document.getElementById('input-text-signature').value, {
|
||||||
|
fontFamily: 'Caveat'
|
||||||
|
});
|
||||||
|
textSignature.top = y - (textSignature.getScaledHeight() / 2);
|
||||||
|
textSignature.left = x - (textSignature.getScaledWidth() / 2);
|
||||||
|
canvasEdition.add(textSignature).renderAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
fabric.loadSVGFromURL(svg2add, function(objects, options) {
|
fabric.loadSVGFromURL(svg2add, function(objects, options) {
|
||||||
options.left = x;
|
var svg = fabric.util.groupSVGElements(objects, options);
|
||||||
options.top = y;
|
svg.scaleToHeight(100);
|
||||||
var obj = fabric.util.groupSVGElements(objects, options);
|
svg.top = y - (svg.getScaledHeight() / 2);
|
||||||
console.log(obj);
|
svg.left = x - (svg.getScaledWidth() / 2);
|
||||||
canvasEdition.add(obj).renderAll();
|
canvasEdition.add(svg).renderAll();
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
12
pdf.html.php
12
pdf.html.php
|
@ -8,6 +8,9 @@
|
||||||
<!-- Bootstrap CSS -->
|
<!-- Bootstrap CSS -->
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-eOJMYsd53ii+scO/bJGFsiCZc+5NDVN2yr8+0RDqr0Ql0h+rP48ckxlpbzKgwra6" crossorigin="anonymous">
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-eOJMYsd53ii+scO/bJGFsiCZc+5NDVN2yr8+0RDqr0Ql0h+rP48ckxlpbzKgwra6" crossorigin="anonymous">
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.4.1/font/bootstrap-icons.css">
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.4.1/font/bootstrap-icons.css">
|
||||||
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Caveat&display=swap" rel="stylesheet">
|
||||||
<title>Signature PDF</title>
|
<title>Signature PDF</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
@ -18,11 +21,12 @@
|
||||||
<h5><i class="bi bi-vector-pen"></i> Signature à main lever</h5>
|
<h5><i class="bi bi-vector-pen"></i> Signature à main lever</h5>
|
||||||
<canvas id="signature-pad" class="border bg-light" width=200 height=150></canvas>
|
<canvas id="signature-pad" class="border bg-light" width=200 height=150></canvas>
|
||||||
<hr />
|
<hr />
|
||||||
|
<h5><i class="bi bi-fonts"></i> Signature texte</h5>
|
||||||
|
<input id="input-text-signature" type="text" class="form-control" placeholder="Ma signature" style="font-family: 'Caveat', cursive; font-size: 24px;" />
|
||||||
|
<hr />
|
||||||
<form id="form-image-upload" action="/image2svg" method="POST" class="row g-3" enctype="multipart/form-data">
|
<form id="form-image-upload" action="/image2svg" method="POST" class="row g-3" enctype="multipart/form-data">
|
||||||
<div class="col-12">
|
<h5><i class="bi bi-image"></i> Importer une image</h5>
|
||||||
<h5><i class="bi bi-image"></i> Importer une image</h5>
|
<input id="input-image-upload" class="form-control" name="image" type="file">
|
||||||
<input id="input-image-upload" class="form-control" name="image" type="file">
|
|
||||||
</div>
|
|
||||||
</form>
|
</form>
|
||||||
<hr />
|
<hr />
|
||||||
<p><small class="text-muted">Double-cliquez sur le PDF pour ajouter la signature</small></p>
|
<p><small class="text-muted">Double-cliquez sur le PDF pour ajouter la signature</small></p>
|
||||||
|
|
Loading…
Reference in a new issue