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 @@ -