Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
I am already using the View-PDF token to display the current page number, that works perfect for me.
Is there also a possibility to have a token available to show the total number of pages?
I would like to show page 1 of 2 on page1 and show page 2 of 2 on page 2.
Thanks, great module by the way!
Comments
Comment #1
maxplus CreditAttribution: maxplus commentedComment #2
vegansupreme CreditAttribution: vegansupreme commentedBased on my LIMITED knowledge of the code, it seems like the only way this could work is when making PDFs with a set number of items per page. Maybe there could be an option on the Views PDF token (field handler?) you're already using to get the page number. In the UI, you would have to specify the number of items per page, and then the code would divide (count($view->result)) by items per page to get the total number of pages.
In cases where there aren't a set number of items per page, Views PDF just adds a new page whenever the content gets close to the bottom. For those types of PDFs I don't think getting the total pages would be possible until after the view is rendered.
Any thoughts?
Comment #3
killua99 CreditAttribution: killua99 commented