I've successfully created a list using the following answer with flexbox on my HTML page How to display 3 items per row in flexbox?
I have a need to create a PDF with this data and I'm using wkhtmltopdf (https://wkhtmltopdf.org/) which also works fine however the PDF generated has all my List Items in 1 long column instead of 3 per row.
Looks like the CSS is not being processed when the PDF generation is happening any insight is appreciated.
Using standard CSS flexbox, you can create a complex PDF or use your existing flexbox-based layouts and designs. Test your document with the complete code examples below, or by using our demo page.
Dompdf does not support flexbox as of this writing (current release is 0.8. 4). Refer to issue 971 for more information. You can generate that layout with a variety of stylings, but if your content goes beyond a page in length you'll run into some quirkiness around the Dompdf rendering process.
The flexbox properties are supported in all modern browsers.
This worked for me :
.row {
display: -webkit-box; /* wkhtmltopdf uses this one */
display: flex;
-webkit-box-pack: center; /* wkhtmltopdf uses this one */
justify-content: center;
}
.row > div {
-webkit-box-flex: 1;
-webkit-flex: 1;
flex: 1;
}
.row > div:last-child {
margin-right: 0;
}
See https://github.com/wkhtmltopdf/wkhtmltopdf/issues/1522 for more informations.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With