@media print { @page { size: A4 landscape; margin: 0.8cm; @bottom-right { content: "Seite " counter(page) " von " counter(pages); font-size: 8pt; margin-right: -0.5cm; margin-bottom: -0.5cm; } } html, body { height: 100%; width: 100%; margin: 0; padding: 0; font-size: 9pt; line-height: 1.3; background: none; color: #000; display: flex; justify-content: center; align-items: flex-start; } .dynamic-table-container { width: 100%; display: flex; justify-content: center; margin-bottom: 1.5cm; } table { width: 100%; max-width: 29.7cm; /* A4 landscape width minus margins */ border-collapse: collapse; page-break-inside: auto; } thead { display: table-header-group; } tbody { display: table-row-group; } tr { page-break-inside: avoid; page-break-after: auto; } th, td { padding: 0.1cm; border: 1px solid #000; text-align: center; vertical-align: middle; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } th { background-color: #f0f0f0 !important; -webkit-print-color-adjust: exact; color-adjust: exact; } a { text-decoration: none; color: #000; } /* Hide elements not needed for print */ #searchInput, .sort-icon::after, .header-container, footer, .print-date { display: none; } /* Column widths */ th:nth-child(1), td:nth-child(1), th:nth-child(2), td:nth-child(2) { width: 15%; } th:nth-child(3), td:nth-child(3) { width: 20%; } th:nth-child(4), td:nth-child(4) { width: 10%; } th:nth-child(5), td:nth-child(5) { width: 25%; } th:nth-child(6), td:nth-child(6) { width: 15%; } /* Remove top margin for the first page */ .dynamic-table-container:first-child { margin-top: 0; } /* Ensure content on subsequent pages starts at the top */ @page :not(:first) { margin-top: 0.8cm; } }