diff --git a/frappe/templates/print_format/macros/Table.html b/frappe/templates/print_format/macros/Table.html
index 7febc899e4..27c0be961c 100644
--- a/frappe/templates/print_format/macros/Table.html
+++ b/frappe/templates/print_format/macros/Table.html
@@ -3,7 +3,7 @@
{{ df.label }}
-
+
{% set columns = df.table_columns %}
diff --git a/frappe/templates/print_format/print_format.css b/frappe/templates/print_format/print_format.css
index 987e6f3093..cb87af301e 100644
--- a/frappe/templates/print_format/print_format.css
+++ b/frappe/templates/print_format/print_format.css
@@ -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;
-}