Add WeasyPrint to convert PDFs

This commit is contained in:
2023-09-06 16:01:48 +02:00
parent 28b424fe65
commit 2b7d19199a
11 changed files with 136 additions and 154 deletions

View File

@ -14,15 +14,18 @@ body {
.m1, .m2, .m3 {
height: 0;
width: 1cm;
width: 10mm;
position: fixed;
left: 0;
border-top: 1pt solid black;
left: -25mm;
border-top: 0.5pt solid black;
}
.m1 {top: 105mm;}
.m2 {top: 148.5mm;}
.m3 {top: 210mm;}
.m1.r, .m2.r, .m3.r {
left: initial;
right: -20mm;
}
.m1 {top: 80mm;}
.m2 {top: 123.5mm;}
.m3 {top: 185mm;}
header, .address-wrapper, aside, main {
overflow: hidden;
@ -40,7 +43,7 @@ header {
header h1{
font-size: 18pt;
margin-top: 1cm;
margin-top: 10mm;
}
.spacing {
@ -50,7 +53,7 @@ header h1{
.info-wrapper {
width: 100%;
height: 45mm;
margin: 0 0 8.46mm 0;
margin: 0 0 2mm 0;
position: relative;
}
@ -60,52 +63,56 @@ header h1{
margin: 0;
padding: 5mm;
position: absolute;
left: 20mm;
left: -5mm;
top: 0;
display: flex;
flex-direction: column;
justify-content: flex-end;
}
.address-wrapper .sender {
flex: 17.7mm 1 1;
height: 4em;
font-size: 8pt;
display: flex;
flex-direction: column;
justify-content: flex-end;
padding-bottom: 2mm;
padding: 1em 0;
}
address {
flex: 27.3mm 1 1;
height: 5em;
white-space: pre-line;
font-size: 12pt;
font-style: normal;
}
table {
width: 100%;
border-collapse: collapse;
table-layout: fixed;
}
table td,
table th {
padding: 0.5mm 1mm;
}
table th {
text-align: center;
}
aside {
height: 40mm;
width: 75mm;
margin: 0;
position: absolute;
left: 125mm;
left: 100mm;
top: 5mm;
}
aside table {
border-collapse: collapse;
border: 1pt solid #808080;
width: calc(100% - 1cm);
margin-right: 1cm;
border: 0.5pt solid #808080;
width: 65mm;
margin-right: 10mm;
}
aside table thead:not(:first-child) tr {
border-top: 1pt solid #808080;
border-top: 0.5pt solid #808080;
}
aside table thead th {
@ -124,54 +131,51 @@ aside table tbody th {
}
main {
margin: 8.46mm 20mm 4.23mm 25mm;
margin: 2em 0 1em 0;
}
main :first-child {
main > *:first-child {
margin-top: 0;
}
main h1, main p {
.main-wrapper h1, .main-wrapper p {
font-size: 12pt;
margin: 1em 0;
text-align: justify;
}
main p {
.main-wrapper p {
widows: 3;
orphans: 3;
hyphens: auto;
hyphens: manual;
}
main .date {
.main-wrapper .date {
margin-bottom: 2em;
text-align: right;
}
main h1 {
.main-wrapper h1 {
margin-bottom: 2em;
}
main p.comment {
.main-wrapper p.comment {
font-size: 10pt;
}
.footer-wrapper {
padding: 0 20mm 0 25mm;
position: running(page-footer);
bottom: 0;
left: 0;
right: 0;
width: 165mm;
}
.pre-footer {
margin: 1em 0;
font-size: 10pt;
display: flex;
}
.pre-footer > * {
flex: 5cm 1 1;
display: inline-block;
width: 33%;
}
.pre-footer .date {
@ -185,30 +189,29 @@ main p.comment {
.pre-footer .page {
text-align: right;
float: right;
}
.pre-fotter .page::after {
.pre-footer .page::after {
content: "Seite 1 von 1";
}
footer {
font-size: 10pt;
border-top: 1pt solid black;
border-top: 0.5pt solid black;
height: 25mm;
padding-top: 1mm;
text-align: center;
}
table {
width: 100%;
border-collapse: collapse;
table-layout: fixed;
}
table.delivery {
margin-bottom: 5mm;
}
table.delivery tr:not(.main) {
break-before: avoid;
}
table.delivery th {
font-weight: normal;
font-style: italic;
@ -237,12 +240,15 @@ table.delivery tr.tight.first td {
padding-bottom: 0;
}
/* FIXME update version of WeasyPrint
table.delivery tr.tight:has(+ tr:not(.tight)) td {
padding-bottom: 0.5mm !important;
}
*/
table.delivery tr.sum {
border-top: 1pt solid black;
border-top: 0.5pt solid black;
break-before: avoid;
}
table.delivery tr.sum td {
@ -295,22 +301,22 @@ table.delivery-stats tbody th {
visibility: hidden;
}
main .bottom {
.main-wrapper .bottom {
bottom: 0;
position: absolute;
width: calc(100% - 25mm - 20mm);
width: 165mm;
}
main .signatures {
.main-wrapper .signatures {
width: 100%;
display: flex;
justify-content: space-around;
margin: 20mm 0 2mm 0;
}
main .signatures > * {
width: 5cm;
border-top: 1pt solid black;
.main-wrapper .signatures > * {
width: 50mm;
border-top: 0.5pt solid black;
padding-top: 1mm;
text-align: center;
font-size: 10pt;
@ -318,7 +324,7 @@ main .signatures > * {
hr {
border: none;
border-top: 1pt solid black;
border-top: 0.5pt solid black;
margin: 5mm 0;
}
@ -333,7 +339,7 @@ tr.page-break {
@page {
size: A4;
margin: 25mm 0 35mm 0;
margin: 25mm 20mm 35mm 25mm;
@bottom-center {
content: element(page-footer);
}
@ -344,13 +350,13 @@ tr.page-break {
width: 210mm;
}
header, .address-wrapper, aside, main {
border: 1pt solid lightgray;
border: 1px solid lightgray;
}
.m1, .m2, .m3 {display: none;}
header {top: 0;}
.spacing {height: 45mm;}
.main-wrapper {
margin-bottom: 40mm;
margin: 0 20mm 40mm 25mm;
}
.footer-wrapper {
position: fixed;
@ -365,7 +371,4 @@ tr.page-break {
.page::after {
content: "Seite " counter(page) " von " counter(pages);
}
.footer-wrapper {
display: none;
}
}