How to you add a table of contents in a pdf for a book that is exported using views_pdf? I am using the book module in Drupal 7 and have successfully exported the whole book as a pdf using views_pdf. However, I would like to add a table of contents on the first page to list all the node/page headers that are in the pdf. It would be nice if the table of contents could then link to each of the page titles in the pdf, but this is not absolutely necessary. Does anyone know how to do this? 

I've looked at the code for views_pdf_template.php and think it can be modified to keep track of all the page headers and associated numbers, and then render it in the close() function. But I'm not sure if this is the right way to do it. Does anyone have any ideas? Or has done this before?

Thanks in advance.
You could write a new view that only contains the table of contents (no idea how hacky this is) and include it into your PDF view as a header. (Header -> Add -> Global -> View)