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.

Members fund testing for the Drupal project. Drupal Association Learn more


Simon Georges’s picture

Version: 7.x-1.0 » 7.x-1.x-dev
Status: Active » Needs review
guillaumev’s picture

3.46 KB

New patch which applies on latest version.

guillaumev’s picture

1.95 KB

New 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...

killua99’s picture

Assigned: Unassigned » killua99
Status: Needs review » Needs work

I'm working on others patchs when I finish them I will start with this. Thanks

killua99’s picture

Priority: Normal » Major


killua99’s picture

Assigned: killua99 » Unassigned
Priority: Major » Normal
Status: Needs work » Fixed

Thanks for the patch guillaumev. Committed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.