How can i force page break?
Did you try the css property page-break-after? Something like this:
<style type="text/css" media="print">
div.page
{
page-break-after: always;
page-break-inside: avoid;
}
</style>
<div class="page">
First page
</div>
<div class="page">
Second page
</div>
This works perfectly, for me at least!
https://github.com/KnpLabs/snappy/issues/74#issuecomment-34427602
I've tried every single way suggested and only the one posted by @barryvdh worked for me. Thanks!
This isn't working for me. Adding the below markup and including the styles above I get all of these on a single page.
<style type="text/css" media="print">
div.page
{
page-break-after: always;
page-break-inside: avoid;
}
</style>
<div class="page">
page 1
</div>
<div class="page">
page 2
</div>
<div class="page">
page 3
</div>
<div class="page">
page 4
</div>
Never mind I had to remove media="print"
Works for me..
<style type="text/css">
.page {
overflow: hidden;
page-break-after: always;
}
.page:last-of-type {
page-break-after: auto
}
</style>
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
Any issues with PDF rendering itself that are not directly related to this package, should be reported on https://github.com/KnpLabs/snappy instead. When having doubts, please try to reproduce the issue with just snappy.
If you believe this is an actual issue with the latest version of laravel-snappy, please reply to this issue so we can investigate further.
Thank you for your contribution! Apologies for any delayed response on our side.
Most helpful comment
Did you try the css property
page-break-after? Something like this: