How to generate Table of Contents (TOC) dynamically in a PDF. The PDF is generated based on XDP and XML input parameters using FormsService/ OutputService API of AEM Forms.
Environment - AEM Forms 6.5 SP 12 (adobe-aemfd-win-pkg-6.0.640) ( On Prem)
Based on our findings it appears that once we create a bookmark in XDP template using Forms designer see [1] and provide input XML source. One should be able to generate PDFs with bookmark using FormsService API. And as a next step we can use AssemblerService API (with DDX [2]) to create Table of Contents dynamically.
However, we are unable to create bookmarks for all of the pages of PDF in XDP, using [1] we can create bookmark for just one page (say Page 3 or 5) but it is inconsistent and does not show bookmark for all other pages in PDF using XDP template. Can anyone help us to find out a sample code or example where generating Table of Contents dynamically using bookmarks is working fine.
P.S. Any adobe office link or private blog with respect to this will be helpful.
[2] <?xml version="1.0" encoding="UTF-8"?>
<DDX xmlns=http://ns.adobe.com/DDX/1.0/>
<PDF result="out.pdf">
<PDF source="pdf1" pages="1"/>
<TableOfContents>
<Header styleReference="TOCheaderStyle"/>
</TableOfContents>
<PDF source="pdf1" pages="3-23"/>
<PDF source="pdf2" pages="1-14"/>
<PDF source="pdf1" pages="24"/>
</PDF>