Continuing on from this thread , how do you prevent the PDF Renderer from applying a page break in the middle of a row of a repeating panel?
I have tried this solution from this thread but had no luck.
Clone of minimal app showing the page break being inserted in to the middle of the row:
Note: I am using a Standard page template with a role “alert-form” to eliminate the scrolling issue.
Any help would be appreciated.
Did you try this one?
printing html is always tricky - here’s a solution that seems to work better
<div class="break-container" style="overflow: hidden;">
<div style="page-break-after:always;"/>
<div style="margin-top: -55px;"/>
</div>
<style>
.break-container {
border: 1px solid grey;
}
@media print {
.break-container {
border: none;
}
}
</style>
You may need to adjust the margin-top property. -55px worked for me.
If you’re debugging removing the border: none will help to see what’s…
A version of that post was also added as a component to anvil-extras
@stucork and I have formed a band and released an album of our greatest solo hits:
That’s a brand new library but it brings together several of the tools and utilities that we’ve both written into one place.
Just add anvil-extras as a dependency and you get a few new components plus goodies like messaging, augmented events, popovers etc. etc.
There’s more detail on the project’s readme and full (ish) documentation at readthedocs.
We have plans for more goodies to add and we’d love to see c…
3 Likes
That was literally the world’s fastest reply!
Yes I did manage to create the component and insert it into the row template but it gave a page break after each row. Ill try fiddle with it again now.
1 Like
I managed to get it to work with this code in the custom component added to the row template:
<div class="break-container" style="overflow: hidden;">
<div style="page-break-inside:avoid;"/>
<div style="margin-top: -55px;"/>
</div>
<style>
.break-container {
border: 1px solid grey;
}
@media print {
.column-panel .has-components {page-break-inside: avoid;}
}
</style>
It doesn’t page break in the row but it has added a lot of padding to the rows (?). Its like they are double line spaced. Any ideas?
EDIT: Scratch that - it seems I am way over tired and there is no padding added…
Thanks @stucork awesome solution!
Clone link of solved minimal example above with Page Break component.
https://anvil.works/build#clone:NWSLSIK4HJXIOXMV=YUTREKOVLWH4WFZIJGBELMTU
3 Likes