mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
solucionado el problema de la impresion de las ots
This commit is contained in:
@ -1,11 +1,24 @@
|
||||
$(() => {
|
||||
var opt = {
|
||||
margin: 2,
|
||||
const elementToPdf = document.querySelector('body'); // o .pdf-wrapper si quieres acotar
|
||||
|
||||
const opt = {
|
||||
margin: 2, // un margen decente
|
||||
filename: $(".pdf-wrapper").data("id") + ".pdf",
|
||||
image: { type: 'jpeg', quality: 1 },
|
||||
html2canvas: { scale: 4 },
|
||||
image: { type: 'jpeg', quality: 0.98 },
|
||||
html2canvas: {
|
||||
scale: 4,
|
||||
useCORS: true,
|
||||
scrollY: -window.scrollY, // importante
|
||||
//windowWidth: document.body.scrollWidth,
|
||||
//windowHeight: document.body.scrollHeight
|
||||
},
|
||||
jsPDF: { unit: 'mm', format: 'a4', orientation: 'portrait' },
|
||||
pagebreak: {
|
||||
mode: ['css', 'legacy'], // intenta usar los saltos naturales
|
||||
before: '.page-break', // puedes insertar <div class="page-break"></div> si lo necesitas
|
||||
avoid: ['table', 'tr', '.row'] // evita cortar tablas
|
||||
}
|
||||
};
|
||||
let elementToPdf = $('body')[0]
|
||||
html2pdf().set(opt).from(elementToPdf).save()
|
||||
})
|
||||
|
||||
html2pdf().set(opt).from(elementToPdf).toPdf().get('pdf').save();
|
||||
});
|
||||
@ -13,24 +13,38 @@
|
||||
|
||||
/* ... the rest of the rules ... */
|
||||
}
|
||||
html,body {
|
||||
font-family: Arial, sans-serif;
|
||||
html, body {
|
||||
width: 210mm;
|
||||
height: 297mm;
|
||||
max-width: 210mm;
|
||||
width: 100%;
|
||||
margin: 0 auto;
|
||||
padding: 0;
|
||||
background: white;
|
||||
font-family: Arial, sans-serif;
|
||||
font-size: 14px;
|
||||
max-height: 297mm;
|
||||
background-color: white;
|
||||
box-sizing: border-box;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
.pdf-wrapper {
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* Opcional: ayuda a evitar cortes raros en tablas o secciones */
|
||||
.page-break {
|
||||
page-break-before: always;
|
||||
}
|
||||
|
||||
|
||||
.page {
|
||||
border: 0px solid;
|
||||
padding: 10px;
|
||||
margin: 10px;
|
||||
width: 100%;
|
||||
max-width: 210mm;
|
||||
max-height: 297mm;
|
||||
height: auto !important;
|
||||
max-height: none !important;
|
||||
/*max-height: 297mm;*/
|
||||
background-color: white;
|
||||
}
|
||||
.portada-img {
|
||||
@ -189,8 +203,15 @@ table th {
|
||||
width: 50px;
|
||||
}
|
||||
.ot-code {
|
||||
font-size: 4em;
|
||||
font-size: 3.5em;
|
||||
}
|
||||
.code-title {
|
||||
font-size: 1.5em;
|
||||
}
|
||||
|
||||
body, html, .pdf-wrapper, .page, div {
|
||||
box-sizing: border-box;
|
||||
max-width: 210mm;
|
||||
overflow-x: hidden;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
Reference in New Issue
Block a user