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()
|
||||
.from(printable.value)
|
||||
.set({
|
||||
@ -217,7 +217,42 @@ 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)
|
||||
@ -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 {
|
||||
|
||||
@ -25,8 +25,8 @@
|
||||
|
||||
<!-- RISULTATI -->
|
||||
|
||||
<div class="section-title">{{ intestazione.prova1 }}</div>
|
||||
<div class="sub-header">{{ intestazione.prova2 }}</div>
|
||||
<div class="section-title" v-html="intestazione.prova1"></div>
|
||||
<div class="sub-header" v-html="intestazione.prova2"></div>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
@ -25,8 +25,8 @@
|
||||
|
||||
<!-- RISULTATI -->
|
||||
|
||||
<div class="section-title">{{ intestazione.prova1 }}</div>
|
||||
<div class="sub-header">{{ intestazione.prova2 }}</div>
|
||||
<div class="section-title" v-html="intestazione.prova1"></div>
|
||||
<div class="sub-header" v-html="intestazione.prova2"></div>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
@ -39,8 +39,8 @@
|
||||
|
||||
<!-- RISULTATI -->
|
||||
|
||||
<div class="section-title">{{ intestazione.prova1 }}</div>
|
||||
<div class="sub-header">{{ intestazione.prova2 }}</div>
|
||||
<div class="section-title" v-html="intestazione.prova1"></div>
|
||||
<div class="sub-header" v-html="intestazione.prova2"></div>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
@ -39,8 +39,8 @@
|
||||
|
||||
<!-- RISULTATI -->
|
||||
|
||||
<div class="section-title">{{ intestazione.prova1 }}</div>
|
||||
<div class="sub-header">{{ intestazione.prova2 }}</div>
|
||||
<div class="section-title" v-html="intestazione.prova1"></div>
|
||||
<div class="sub-header" v-html="intestazione.prova2"></div>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user