You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been trying to figure out a way to ensure an entire section fits on the remaining part of the page, if not, start a new page with it. Right now the only way I can do it is by calculating the height of a block beforehand, but that gets more and more complicated depending on the content.
Some alternative options I was trying to investigate:
Before each block, save current page state. Run the block, if it overruns the page, reset to the old state and do it on a new page. This would require using the private internals and even then might not work.
Before each block, create a new test document with part of the current state, if the dry run fails then start on a new page, if not, do it on the real PDF. This ended up breaking when using helpers because the test document couldn't have the same context as the actual PDF.
Create the PDF once, when a block overflows the page, re-render the full block on the next page. Actually renders the text every time, but saves the best option. When it finishes going through the whole document, erase it and start over but only using the best options.
I'd appreciate any help. I've been stuck on this a while and haven't made any progress.
The text was updated successfully, but these errors were encountered:
In my case, I use prawn-table with just 1 column and each block is one row, row will be rendered in new page if the current page does not enough space.
I've been trying to figure out a way to ensure an entire section fits on the remaining part of the page, if not, start a new page with it. Right now the only way I can do it is by calculating the height of a block beforehand, but that gets more and more complicated depending on the content.
Some alternative options I was trying to investigate:
Before each block, save current page state. Run the block, if it overruns the page, reset to the old state and do it on a new page. This would require using the private internals and even then might not work.
Before each block, create a new test document with part of the current state, if the dry run fails then start on a new page, if not, do it on the real PDF. This ended up breaking when using helpers because the test document couldn't have the same context as the actual PDF.
Create the PDF once, when a block overflows the page, re-render the full block on the next page. Actually renders the text every time, but saves the best option. When it finishes going through the whole document, erase it and start over but only using the best options.
I'd appreciate any help. I've been stuck on this a while and haven't made any progress.
The text was updated successfully, but these errors were encountered: