(pl)(spis) make census more print-friendly

This commit is contained in:
Andrea Vos 2025-09-16 20:37:54 +02:00
parent ea3b6a360e
commit de13ddbf5c
2 changed files with 28 additions and 2 deletions

View File

@ -5,8 +5,8 @@
display: none;
}
body {
background: none;
background-color: $white;
background: none !important;
color: $black !important;
}
hr {
display: block;
@ -16,4 +16,16 @@
@page {
margin: 1cm;
}
details {
break-inside: avoid;
margin-bottom: 1em;
p {
margin: 1em;
}
}
th, td {
color: $black !important;
}
}

View File

@ -92,6 +92,20 @@ onMounted(executeUnlessPrerendering(() => {
window.location.reload();
}
};
// making census reports print-friendly
window.addEventListener("beforeprint", () => {
document.querySelectorAll("iframe[loading=lazy]").forEach(iframe => {
iframe.removeAttribute("loading");
iframe.setAttribute("src", iframe.getAttribute("src")!);
});
document.querySelectorAll("iframe.graph").forEach(iframe => {
const graph = iframe as HTMLIFrameElement;
graph.style.width = "718px"; // A4 width - 1cm margins at 96dpi
graph.style.height = "400px";
});
document.querySelectorAll("details").forEach(d => d.setAttribute("open", ""));
});
}));
const dialogue = useDialogue();