Closed rafaeldev closed 1 year ago
I found this issue with the same problem and a good example to test:
test.html.txt (remove txt extension)
I found this answer
Basically, I added this classes to my CSS file:
table { word-break: break-word; }
tr { page-break-inside: avoid !important; }
thead, tfoot {
display: table-row-group;
}
@rafaeldev Thank you for this solution! Works perfectly! 🍻
How you apply bootstrap to your pdf?
@snjhyrglr what kind of problem do you have? You can't import at all?
So, I try show my context:
I created a file pdf.scss
with some imports, including bootstrap:
@import "bootstrap/scss/bootstrap";
@import "old_grid";
@import "mixins/core";
@import "mixins/fonts";
@import "mixins/colors";
body,
html {
font-family: 'Inter', sans-serif;
}
div {
&.alwaysbreak { page-break-before: always !important; }
&.nobreak:before { clear: both !important; }
&.nobreak { page-break-inside: avoid !important; }
}
table { word-break: break-word; }
tr { page-break-inside: avoid !important; }
thead, tfoot {
display: table-row-group;
}
.outline {
p {
font-size: 16px;
}
}
div.row.outline,
div.container {
padding-left: 0 !important;
padding-right: 0 !important;
}
div.bg-white.shadow {
box-shadow: 0 0 0 rgba(0, 0, 0, 0) !important;
}
.border-dark {
border-color: #000 !important;
}
.border-bottom {
border-bottom: 1px solid;
}
I'm using esbuild and yarn to import my frontend libraries and it's possible to import bootstrap like that.
important disclaimer: the old_grid
it's for to override to use old grid system. It's because the wkhtmltopdf
can't handle new flexbox system. I created a gist to you use if necessary.
https://gist.github.com/rafaeldev/21017254b5df0b43a91af4c81c7a3012
Now, on pages, I import pdf.css
this way:
<!DOCTYPE html>
<html lang="pt-BR" dir="ltr">
<head>
<meta charset="utf-8">
<title>Title</title>
<%= wicked_pdf_stylesheet_link_tag "pdf" %>
</head>
<body>
<h1>Title</h1>
</body>
</html>
Let me know if it's works
Issue description
I have a table to list some info where at its final, show a sum of infos. I'm using bootstrap stylish it.
When that table is big, it repeat ffoot info in each page:
Table structure:
Expected or desired behavior
Don't repeat
tfoot
infoSystem specifications
wkhtmltopdf version (output of
wkhtmltopdf --version
):wkhtmltopdf 0.12.6.1 (with patched qt)