fix(print): margins not taken into consideration

This commit is contained in:
Elian Doran
2026-04-19 11:11:56 +03:00
parent 4ae3a00464
commit 3839dad55d
2 changed files with 8 additions and 3 deletions

View File

@@ -4,9 +4,6 @@
--print-font-size: 11pt;
}
@page {
margin: 2cm;
}
html,
body {

View File

@@ -32,6 +32,14 @@ async function main() {
await import("./print.css");
// Browser printing relies on @page margins since there's no programmatic control.
// Electron uses printToPDF() margins instead, so we only inject this for the browser path.
if (!isElectron()) {
const style = document.createElement("style");
style.textContent = "@page { margin: 2cm; }";
document.head.appendChild(style);
}
// Load the user's font preferences so that --detail-font-family is available.
const fontLink = document.createElement("link");
fontLink.rel = "stylesheet";