diff --git a/app/main.py b/app/main.py index 4ea51d9..58bdff8 100644 --- a/app/main.py +++ b/app/main.py @@ -3459,7 +3459,11 @@ async def _render_scorecard_pdf( width=width, height=height, ) - page_size_css = f"@page {{ size: {width}px {height}px; margin: 0; }}" + # `size: NNNpt` → PDF-Page hat exakt N×M Punkte. PyMuPDF rendert + # bei zoom=1 dann 1 PDF-Punkt = 1 PNG-Pixel. CSS-Pixel werden + # aber auch in pt umgerechnet (96dpi → 72dpi → ×0.75) — daher + # konvertiere pt→css-px so, dass die Inhalts-Layouts passen. + page_size_css = f"@page {{ size: {width}pt {height}pt; margin: 0; }}" pdf = HTML(string=html_content).write_pdf(stylesheets=[CSS(string=page_size_css)]) safe = drucksache.replace("/", "-") return pdf, width, height, f"scorecard-{safe}-{format}"