From ce839f1d07788c9b5871fcb627cb595d82f95d51 Mon Sep 17 00:00:00 2001 From: "LORENZO\\pacio" Date: Tue, 22 Jul 2025 09:48:19 +0200 Subject: [PATCH] 20250722 --- src/App.vue | 40 +++++++++++++++++++++++++++--- src/components/risultati/A_CIL.vue | 4 +-- src/components/risultati/A_CUB.vue | 4 +-- src/components/risultati/B_BAR.vue | 4 +-- src/components/risultati/B_RET.vue | 4 +-- 5 files changed, 44 insertions(+), 12 deletions(-) diff --git a/src/App.vue b/src/App.vue index 7c34d14..e6c7fcd 100644 --- a/src/App.vue +++ b/src/App.vue @@ -204,7 +204,7 @@ function capitalizeEachWord(str) { } -function exportPdf(filename = 'certificato-prova.pdf') { +/*function exportPdf(filename = 'certificato-prova.pdf') { html2pdf() .from(printable.value) .set({ @@ -217,8 +217,43 @@ function exportPdf(filename = 'certificato-prova.pdf') { } }) .save() +}*/ + +function exportPdf(filename = 'certificato-prova.pdf') { + const opt = { + margin: 0, + filename, + html2canvas: { scale: 2 }, + jsPDF: { unit: 'mm', format: [210, 297], orientation: 'portrait' }, + pagebreak: { mode: ['css','legacy'] } + }; + + html2pdf() + .set(opt) + .from(printable.value) + .toPdf() + .get('pdf') + .then(pdf => { + const totalPages = pdf.internal.getNumberOfPages(); + const pageWidth = pdf.internal.pageSize.getWidth(); + const pageHeight = pdf.internal.pageSize.getHeight(); + + for (let i = 1; i <= totalPages; i++) { + pdf.setPage(i); + pdf.setFontSize(9); + pdf.text( + `Pagina ${i} di ${totalPages}`, + pageWidth / 2, + pageHeight - 8, // 8mm up from bottom + { align: 'center' } + ); + } + }) + .save(); } + + function formatDate(dateStr) { const date = new Date(dateStr) return date.toLocaleDateString('it-IT') @@ -324,9 +359,6 @@ header { margin-top: 16px; margin-bottom: 2px; text-align: center; - - white-space: pre-wrap; /* preserves newlines */ - word-break: break-word; /* wraps long lines if needed */ } .sub-header { diff --git a/src/components/risultati/A_CIL.vue b/src/components/risultati/A_CIL.vue index 08bc5c2..adda9e3 100644 --- a/src/components/risultati/A_CIL.vue +++ b/src/components/risultati/A_CIL.vue @@ -25,8 +25,8 @@ -
{{ intestazione.prova1 }}
-
{{ intestazione.prova2 }}
+
+
diff --git a/src/components/risultati/A_CUB.vue b/src/components/risultati/A_CUB.vue index f6ddf79..b9d4249 100644 --- a/src/components/risultati/A_CUB.vue +++ b/src/components/risultati/A_CUB.vue @@ -25,8 +25,8 @@ -
{{ intestazione.prova1 }}
-
{{ intestazione.prova2 }}
+
+
diff --git a/src/components/risultati/B_BAR.vue b/src/components/risultati/B_BAR.vue index e59fe17..ba139a3 100644 --- a/src/components/risultati/B_BAR.vue +++ b/src/components/risultati/B_BAR.vue @@ -39,8 +39,8 @@ -
{{ intestazione.prova1 }}
-
{{ intestazione.prova2 }}
+
+
diff --git a/src/components/risultati/B_RET.vue b/src/components/risultati/B_RET.vue index c47437d..85e7ea1 100644 --- a/src/components/risultati/B_RET.vue +++ b/src/components/risultati/B_RET.vue @@ -39,8 +39,8 @@ -
{{ intestazione.prova1 }}
-
{{ intestazione.prova2 }}
+
+