Expand my Community achievements bar.

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.

Avatar

Level 2

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.

 

[1] https://help.adobe.com/en_US/livecycle/11.0/Services/WS57a26560eb6a24db-6e5d73fa131760810bd-8000.2.h...

 

[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>

 

 

4 Replies

Avatar

Community Advisor

Hi @nitin_seth,

  • Apache Velocity Engine [0] - Dynamic data replacement with the placeholder. (Official Documentation [1]) - Velocity Template Language (VTL)
    I have used this approach previously where we had to generate pdf with user filled forms and that data has to be rendered on pdf with actual data along with prefixes. eg First Name : ${customeName}

[0]: https://www.albinsblog.com/2015/04/how-to-send-html-email-using-velocity-adobecq5.html#.Y3ucHuzMLdo

[1]: https://velocity.apache.org/engine/

Hope that helps!

Regards,

Santosh

Avatar

Employee Advisor

@SantoshSai This is a different product, this relates to assembler API for forms.

Avatar

Employee Advisor

@nitin_seth share one xdp with me with the DDX file for assembler which is causing issue

Avatar

Level 1

Mayank, we got it working with OOTB gotoPage [1] 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 [1] 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.

 

[1] https://help.adobe.com/en_US/livecycle/11.0/Services/WS57a26560eb6a24db-6e5d73fa131760810bd-8000.2.h...