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

Filename with count signature

This commit is contained in:
Vincent LAURENT 2022-04-02 01:54:21 +02:00
parent 4a261db73e
commit 4051264f78
3 changed files with 4 additions and 3 deletions

View File

@ -210,6 +210,7 @@ $f3->route('GET /signature/@hash/pdf',
if (!$layers) { if (!$layers) {
Web::instance()->send($originalFile, null, 0, TRUE, $filename); Web::instance()->send($originalFile, null, 0, TRUE, $filename);
} }
$filename = str_replace('.pdf', '_signe-'.count($layers).'x.pdf', $filename);
copy($originalFile, $finalFile); copy($originalFile, $finalFile);
$bufferFile = str_replace('.pdf', '_tmp.pdf', $originalFile); $bufferFile = str_replace('.pdf', '_tmp.pdf', $originalFile);
foreach($layers as $layerFile) { foreach($layers as $layerFile) {

View File

@ -1040,7 +1040,7 @@ var pageSignature = async function(url) {
} }
pdfBlob = await response.blob(); pdfBlob = await response.blob();
if(response.headers.get('Content-Disposition').match(/attachment; filename="/)) { if(response.headers.get('Content-Disposition').match(/attachment; filename="/)) {
filename = response.headers.get('Content-Disposition').replace(/^[^"]*"/, "").replace(/"[^"]*$/, ""); filename = response.headers.get('Content-Disposition').replace(/^[^"]*"/, "").replace(/"[^"]*$/, "").replace(/_signe-[0-9]+\x.pdf/, '.pdf');
} }
} else { } else {
pdfBlob = await getPDFBlobFromCache(url); pdfBlob = await getPDFBlobFromCache(url);

View File

@ -44,7 +44,7 @@
<button type="button" class="btn-close text-reset d-md-none" data-bs-dismiss="offcanvas" aria-label="Close"></button> <button type="button" class="btn-close text-reset d-md-none" data-bs-dismiss="offcanvas" aria-label="Close"></button>
</div> </div>
<div class="offcanvas-body pt-0"> <div class="offcanvas-body pt-0">
<p id="text_document_name" class="text-muted" style="text-overflow: ellipsis; white-space: nowrap; overflow: hidden;" title="Lettre de demande de renouvellement aux SCOP_signe.pdf"><i class="bi bi-files"></i> <span>Lettre de demande de renouvellement aux SCOP_signe.pdf</span></p> <p id="text_document_name" class="text-muted" style="text-overflow: ellipsis; white-space: nowrap; overflow: hidden;" title=""><i class="bi bi-files"></i> <span></span></p>
<div class="form-check form-switch mb-2 small d-none"> <div class="form-check form-switch mb-2 small d-none">
<input class="form-check-input" type="checkbox" id="add-lock-checkbox" disabled="disabled"> <input class="form-check-input" type="checkbox" id="add-lock-checkbox" disabled="disabled">
<label style="cursor: pointer;" class="form-check-label" for="add-lock-checkbox"> Garder la séléction active</label> <label style="cursor: pointer;" class="form-check-label" for="add-lock-checkbox"> Garder la séléction active</label>
@ -231,6 +231,6 @@
hash = "<?php echo $hash ?>"; hash = "<?php echo $hash ?>";
<?php endif; ?> <?php endif; ?>
</script> </script>
<script src="/js/signature.js?202204011832"></script> <script src="/js/signature.js?202204020154"></script>
</body> </body>
</html> </html>