Hi saNNNy,
Bookmarks functionallity is not implemented in DK PDF but in DK PDF Generator (pro addon), where bookmarks are generated based on the titles of your selected posts:
http://codecanyon.net/item/dk-pdf-generator/13530581
eBook example generated with DK PDF Generator:
http://wp.dinamiko.com/demos/dkpdf-generator/wp-content/uploads/2016/03/Short-stories-by-David-Phelps-Abbott.pdf
Templates in DK PDF Generator are a bit different because loops through all your selected posts instead of getting only the content of the current post, but you can get the idea, this is the code responsible of generating the bookmarks in DK PDF Generator:
in the template (dkpdfg-index.php) I have this:
<h1><?php the_title();?></h1>
then in functions (dkpdfg-functions.php) I’ve this:
$mpdf->h2toc = array( ‘H1’=>0 );
$mpdf->h2bookmarks = array( ‘H1’=>0 );
for nested bookmarks you can use something like this:
$mpdf->h2bookmarks = array( ‘H1’=>0, ‘H2’=>1, ‘H3’=>2);
Thanks.
I forgot to mention that you’ve to actually output it 🙂
there is a line of code before of the above:
$mpdf->WriteHTML('<tocpagebreak toc-preHTML="<h2>'. $toc_title .'</h2>" paging="on" links="on" resetpagenum="1" toc-odd-footer-value="-1" toc-odd-header-value="-1" />');
$mpdf->h2toc = array( 'H1'=>0 );
$mpdf->h2bookmarks = array( 'H1'=>0 );
Thanks.
Thread Starter
Sany
(@sannny)
Thank you very much for your fast and detailed answer. I’ll give this a try.