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  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 ) to create Table of Contents dynamically.
However, we are unable to create bookmarks for all of the pages of PDF in XDP, using  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.
 <?xml version="1.0" encoding="UTF-8"?>
<PDF source="pdf1" pages="1"/>
<PDF source="pdf1" pages="3-23"/>
<PDF source="pdf2" pages="1-14"/>
<PDF source="pdf1" pages="24"/>
Hope that helps!
Mayank, we got it working with OOTB gotoPage  for all the pages. However we are looking for any OOTB solutions available in forms designer (XDP template) where one can generate the Table of contents dynamically soon after PDF was created using FormsService/ OutputService?
For info we did following to generate the Table of contents (TOC) dynamically for a given XDP & XML input:
- create bookmark in XDP template by applying the script  at subform level on each page where bookmark was needed
- prepared XML data based on schema
- used Forms Outputservice API to generate the Document object
- passed same doc object to AssemblerService with a DDX rule to generate the TOC along with PDF
- TOC at page no# 2 was generated perfectly fine along with other required PDF pages
however internally we are still verifying if we can generate TOC from within XDP itself? or possibilities of any OOTB solutions if any, do let us know. thanks.