fix: print style

- bordered table
- pdf column rendering fix
- document-header class
This commit is contained in:
Faris Ansari 2021-10-19 19:20:08 +05:30
parent 090a5db7f8
commit a4746483ab
2 changed files with 17 additions and 8 deletions

View file

@ -3,7 +3,7 @@
<div class="label">
{{ df.label }}
</div>
<table class="table">
<table class="table table-bordered">
{% set columns = df.table_columns %}
<thead>
<tr class="table-row">

View file

@ -12,8 +12,8 @@
margin-bottom: {{ print_format.margin_bottom | int }}mm;
margin-left: {{ print_format.margin_left | int }}mm;
margin-right: {{ print_format.margin_right | int }}mm;
padding-top: {{ header_height }}px;
padding-bottom: {{ footer_height }}px;
padding-top: {{ (header_height or 0) + 8 }}px;
padding-bottom: {{ (footer_height or 0) + 8 }}px;
/* page number */
{% set page_number_position = print_format.page_number.lower().replace(' ', '_') %}
@ -31,6 +31,15 @@ body {
max-width: {{ body_width | int }}mm !important;
}
/* CSS rules to fix bootstrap column rendering in PDF
https://github.com/Kozea/WeasyPrint/issues/697#issuecomment-542338732
*/
@media print {
.col, *[class^="col-"] {
max-width: none !important;
}
}
@media screen {
html {
background-color: var(--gray-200);
@ -74,12 +83,12 @@ body {
page-break-inside: avoid;
}
.table-row td, .table-row th {
.page-break {
page-break-after: always;
}
.document-header {
border-bottom-width: 1px;
border-bottom-style: solid;
border-bottom-color: var(--gray-300);
}
.page-break {
page-break-after: always;
}