Some useful functions for AEM Forms Developer.

The AemFormGoodies bundle makes it easy to create org.w3c.dom.Document or AEMFD Document, assemble documents from repository paths.

Prerequisite – Follow the steps mentioned in this article.These steps are needed if you are accessing the repository

The following are the methods exposed by this bundle

 

 public com.adobe.aemfd.docmanager.Document getAEMFDDocument(String repositoryPath)

Returns com.adobe.aemfd.docmanager.Document given a repositoryPath. The following
example returns AEMFD Document from the given repository path com.adobe.aemfd.docmanager.Document ddxDocument = aemFormGoodies.getAEMFDDocument("/content/usergenerated/content/ddx.xml/jcr:content");

public com.adobe.aemfd.docmanager .Document assembleDocuments(List listOfPaths, com.adobe.aemfd.docmanager.Document ddxDocument)

This method assembles PDF's located in the jcr paths using the ddxDocument specified.

listOfPaths could be specified as

listOfPaths.add("/content/dam/dmv/titleapplications/mn/Application.pdf/jcr:content/renditions/original/jcr:content");

listOfPaths.add("/content/dam/dmv/titleapplications/wi/mv1.pdf/jcr:content/renditions/original/jcr:content");.
Make sure you provide the path up to the node which has the “jcr:data” property

The following code snippet shows the usage of the assembleDocuments

 

com.mergeandfuse.aemformsgoodies.AemFormGoodies aemFormGoodies = sling.getService (com.mergeandfuse.aemformsgoodies.AemFormGoodies.class);
com.adobe.aemfd.docmanager.Document ddxDocument = aemFormGoodies.getAEMFDDocument("/content/usergenerated/content/ddx.xml/jcr:content");
com.adobe.aemfd.docmanager.Document assembledDocument = aemFormGoodies.simpleassemblyOfDocuments(listOfPaths);
assembledDocument.copyToFile(new File("c:\\assembled.pdf"));

Note:

The other functions listed in this bundle are as follows. The function names are self explanatory

public org.w3c.dom.Document getOrgW3cDocument(String repositoryPath)

public com.adobe.aemfd.docmanager.Document orgW3CDocumentToAEMFDDocument(org.w3c.dom.Document xmlDocument)


public com.adobe.aemfd.docmanager.Document Document simpleassemblyOfDocuments(List<String> listOfPaths)


Assembles PDF from the list of JCR Paths provided. Make sure the documents in the path are not XFA basedforms. This function assembles the documents without any bookmarks . It is a plain simpple assembly of documents.

Download

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy