Work around page breaking issue

This commit is contained in:
2023-08-12 22:53:28 +02:00
parent 0ea77656e3
commit 244de52b19
3 changed files with 50 additions and 14 deletions

View File

@ -5,6 +5,13 @@
<div class="date">@Model.Location, am @($"{Model.Date:dd.MM.yyyy}")</div> <div class="date">@Model.Location, am @($"{Model.Date:dd.MM.yyyy}")</div>
<h1>@Model.Title</h1> <h1>@Model.Title</h1>
@if (Model.Delivery.Parts.Count > 2) {
<p>Siehe nächste Seite.</p>
if (Model.Delivery.Year == Model.CurrentNextSeason) {
<p>Gesamtlieferung usw.</p>
}
<hr class="page-break"/>
}
<table class="delivery"> <table class="delivery">
<colgroup> <colgroup>
<col style="width: 1cm;"/> <col style="width: 1cm;"/>
@ -57,6 +64,9 @@
@if (Model.Delivery.Comment != null) { @if (Model.Delivery.Comment != null) {
<p class="comment">Amerkung zur Lieferung: @Model.Delivery.Comment</p> <p class="comment">Amerkung zur Lieferung: @Model.Delivery.Comment</p>
} }
@if (Model.Delivery.Parts.Count <= 2 && Model.Delivery.Year == Model.CurrentNextSeason) {
<p>Gesamtlieferung usw.</p>
}
@for (int i = 0; i < 2; i++) { @for (int i = 0; i < 2; i++) {
<div class="@(i == 0 ? "bottom" : "hidden")"> <div class="@(i == 0 ? "bottom" : "hidden")">
@if (Model.Text != null) { @if (Model.Text != null) {

View File

@ -11,6 +11,7 @@ namespace Elwig.Documents {
public Document(string title) { public Document(string title) {
var c = App.Client; var c = App.Client;
DataPath = App.DataPath; DataPath = App.DataPath;
CurrentNextSeason = Utils.CurrentNextSeason;
Title = title; Title = title;
Header = $"<h1>{c.Name}</h1>"; Header = $"<h1>{c.Name}</h1>";
Footer = $"{c.NameFull}<br/>" + Footer = $"{c.NameFull}<br/>" +
@ -32,6 +33,7 @@ namespace Elwig.Documents {
} }
public string DataPath { get; set; } public string DataPath { get; set; }
public int CurrentNextSeason { get; set; }
public string Title { get; set; } public string Title { get; set; }
public string Header { get; set; } public string Header { get; set; }
public string Footer { get; set; } public string Footer { get; set; }

View File

@ -10,7 +10,6 @@
body { body {
margin: 0; margin: 0;
break-inside: avoid;
} }
.m1, .m2, .m3 { .m1, .m2, .m3 {
@ -44,7 +43,9 @@ header h1{
margin-top: 1cm; margin-top: 1cm;
} }
.spacing {height: 20mm;} .spacing {
height: 20mm;
}
.info-wrapper { .info-wrapper {
width: 100%; width: 100%;
@ -118,11 +119,6 @@ aside table tbody th {
font-weight: normal; font-weight: normal;
} }
.main-wrapper,
.main-wrapper * {
break-inside: auto;
}
main { main {
margin: 8.46mm 20mm 4.23mm 25mm; margin: 8.46mm 20mm 4.23mm 25mm;
} }
@ -135,8 +131,12 @@ main h1, main p {
font-size: 12pt; font-size: 12pt;
margin: 1em 0; margin: 1em 0;
text-align: justify; text-align: justify;
}
main p {
widows: 3; widows: 3;
orphans: 3; orphans: 3;
hyphens: auto;
} }
main .date { main .date {
@ -150,7 +150,6 @@ main h1 {
main p.comment { main p.comment {
font-size: 10pt; font-size: 10pt;
hyphens: auto;
} }
.footer-wrapper { .footer-wrapper {
@ -167,13 +166,24 @@ main p.comment {
display: flex; display: flex;
} }
.pre-footer .date, .pre-footer .page { .pre-footer > * {
flex: 100px 1 1; flex: 5cm 1 1;
} }
.pre-footer .date {text-align: left;} .pre-footer .date {
.pre-footer .page {text-align: right;} text-align: left;
.page::after { }
.pre-footer .doc-id {
text-align: center;
font-style: italic;
}
.pre-footer .page {
text-align: right;
}
.pre-fotter .page::after {
content: "Seite 1 von 1"; content: "Seite 1 von 1";
} }
@ -210,6 +220,9 @@ table.delivery tr.main td {
padding-top: 2mm; padding-top: 2mm;
} }
.hidden {
visibility: hidden;
}
main .bottom { main .bottom {
bottom: 0; bottom: 0;
@ -232,6 +245,17 @@ main .signatures > * {
font-size: 10pt; font-size: 10pt;
} }
hr {
border: none;
border-top: 1pt solid black;
margin: 5mm 0;
}
hr.page-break {
display: none;
break-after: page;
}
@page { @page {
size: A4; size: A4;
margin: 25mm 0 35mm 0; margin: 25mm 0 35mm 0;