20250722
This commit is contained in:
parent
a9a8a60bbf
commit
ce839f1d07
40
src/App.vue
40
src/App.vue
@ -204,7 +204,7 @@ function capitalizeEachWord(str) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function exportPdf(filename = 'certificato-prova.pdf') {
|
/*function exportPdf(filename = 'certificato-prova.pdf') {
|
||||||
html2pdf()
|
html2pdf()
|
||||||
.from(printable.value)
|
.from(printable.value)
|
||||||
.set({
|
.set({
|
||||||
@ -217,8 +217,43 @@ function exportPdf(filename = 'certificato-prova.pdf') {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.save()
|
.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) {
|
function formatDate(dateStr) {
|
||||||
const date = new Date(dateStr)
|
const date = new Date(dateStr)
|
||||||
return date.toLocaleDateString('it-IT')
|
return date.toLocaleDateString('it-IT')
|
||||||
@ -324,9 +359,6 @@ header {
|
|||||||
margin-top: 16px;
|
margin-top: 16px;
|
||||||
margin-bottom: 2px;
|
margin-bottom: 2px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
||||||
white-space: pre-wrap; /* preserves newlines */
|
|
||||||
word-break: break-word; /* wraps long lines if needed */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.sub-header {
|
.sub-header {
|
||||||
|
|||||||
@ -25,8 +25,8 @@
|
|||||||
|
|
||||||
<!-- RISULTATI -->
|
<!-- RISULTATI -->
|
||||||
|
|
||||||
<div class="section-title">{{ intestazione.prova1 }}</div>
|
<div class="section-title" v-html="intestazione.prova1"></div>
|
||||||
<div class="sub-header">{{ intestazione.prova2 }}</div>
|
<div class="sub-header" v-html="intestazione.prova2"></div>
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@ -25,8 +25,8 @@
|
|||||||
|
|
||||||
<!-- RISULTATI -->
|
<!-- RISULTATI -->
|
||||||
|
|
||||||
<div class="section-title">{{ intestazione.prova1 }}</div>
|
<div class="section-title" v-html="intestazione.prova1"></div>
|
||||||
<div class="sub-header">{{ intestazione.prova2 }}</div>
|
<div class="sub-header" v-html="intestazione.prova2"></div>
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@ -39,8 +39,8 @@
|
|||||||
|
|
||||||
<!-- RISULTATI -->
|
<!-- RISULTATI -->
|
||||||
|
|
||||||
<div class="section-title">{{ intestazione.prova1 }}</div>
|
<div class="section-title" v-html="intestazione.prova1"></div>
|
||||||
<div class="sub-header">{{ intestazione.prova2 }}</div>
|
<div class="sub-header" v-html="intestazione.prova2"></div>
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@ -39,8 +39,8 @@
|
|||||||
|
|
||||||
<!-- RISULTATI -->
|
<!-- RISULTATI -->
|
||||||
|
|
||||||
<div class="section-title">{{ intestazione.prova1 }}</div>
|
<div class="section-title" v-html="intestazione.prova1"></div>
|
||||||
<div class="sub-header">{{ intestazione.prova2 }}</div>
|
<div class="sub-header" v-html="intestazione.prova2"></div>
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user