I have a use case where I need to force a page break after a specific number of view rows have been output. The automatic page breaking doesn't work with my particular layout for some reason - something to do with the way it calculates if there's enough room for one of the fields that happens to be an image. The solution I found for this was to use some PHP code before the first field to disable automatic page breaking and then implement a new feature in the page break field that lets you specify after how many view rows the break should be inserted. In addition to that, I found what seemed like a bug, in that if your first field on the page is displayed relative to the last writing position, then the first field on the next page does not get rendered at the top of the page but instead in a position relative to the last writing position on the previous page. In other words, it would start at the bottom of the next page.
I have written a patch that kills these two birds with one stone and am submitting it for consideration. I'm not sure if the fix for the last writing position is quite right, but please review and let me know if there's a better way to implement this.
I have also attached an example of the resulting PDF so you can see this in action in my use case. My case was rather special and still required some PHP code before and after some field output in order to get the desired end result, but the page breaking seems like something you should be able to have this greater level of control over regardless of any special cases.
Comment | File | Size | Author |
---|---|---|---|
#3 | 1972158-page_break-3.patch | 1.95 KB | guillaumev |
#2 | 1972158-page_break-2.patch | 3.46 KB | guillaumev |
view_lightbox.pdf | 363.17 KB | teknocat | |
views_pdf_page_break_fix.patch | 5.03 KB | teknocat |
Comments
Comment #1
Simon Georges CreditAttribution: Simon Georges commentedComment #2
guillaumev CreditAttribution: guillaumev commentedNew patch which applies on latest version.
Comment #3
guillaumev CreditAttribution: guillaumev commentedNew patch which works, assuming you render the PDF Page Break as HTML. The other patch did NOT work for me, as views renders everything 2 times, so the countRecords variable was wrong when views was rendering it the second time...
Comment #4
killua99 CreditAttribution: killua99 commentedI'm working on others patchs when I finish them I will start with this. Thanks
Comment #5
killua99 CreditAttribution: killua99 commentedSorry.
Comment #6
killua99 CreditAttribution: killua99 commentedThanks for the patch guillaumev. Committed