TOC Links are not clickable when admin example is used as script
-
Here is the example by admin that creates a clickable TOC in chrome.
https://playground.jsreport.net/w/admin/akYBA4rSI tried replicating the same by using the script instead of pdfutils, however, this does not seem to work.
https://playground.jsreport.net/w/anon/V2YV9L6qCan someone please help me?
-
Please see some theory here https://jsreport.net/learn/pdf-utils#toc-table-of-contents
The working demo renders TOC twice -> once to add content to the chapter labels and the second time to merge in the page numbers. The second time it renders it intentionally hides the content of the chapter labels and that is what is happening in your code. This is the exact part of the code<a class='{{{addClassOnPdfMerge @root "toc-hidden"}}}'
To fix this you could remove the intentional hiding of labels and result into this:
https://playground.jsreport.net/w/anon/_CmxM70tHowever, because of the pdf utils limitation, the clickable links don't work across multiple appended pdf documents.
https://github.com/jsreport/jsreport/issues/771
The only option is to make the TOC part of the main document like in the working demo.
-
Thanks, I got the idea now and was able to implement without need to script here using jsreport.documentStore.collection and pdfutils.
Resolving