After creating and testing your print channel document, we need a mechanism to generate these document in batch mode or on demand. Typically, these kinds of documents are generated in batch mode and the most common mechanism is using watched folder.
When you configure a watched folder in AEM, you associate an ECMA script or java code that gets executed when a file is dropped into the watched folder. In this article, we will focus on ECMA script which will generate print channel documents and save them to the file system.
The watched folder configuration and the ECMA script is provided as part of this article
The input file that is dropped into the watched folder has the following structure. The ECMA script reads the account numbers and generates print channel document for each of these accounts.
For more details on the ECMA script for generating documents, refer to this article
<accountnumbers> <accountnumber>509840</accountnumber> <accountnumber>948576</accountnumber> <accountnumber>398762</accountnumber> <accountnumber>291723</accountnumber> <accountnumber>291724</accountnumber> <accountnumber>291725</accountnumber> <accountnumber>291726</accountnumber> <accountnumber>291727</accountnumber> </accountnumbers>
To generate print channel document using the watched folder mechanism, please follow the steps below:
- Download and import the first file into AEM using the package manager. This file has service user bundle which is needed to generate the print channel document using watched folder.
- Create a system user called data. Make sure you are logged in as admin to create the system user
- Make sure this system user has read permissions on the following node. To give the permissions login to user admin and search for the system user "data" and give the read permissions on the following node by tabbing to the permissions tab
- Navigate to /etc/
- Make sure the path to interactiveCommunicationsDocument is pointing to the correct document that you want to print
- Make a note of the saveLocation(Line 2)
.Youcan change it as per your needs.
- Make sure the input parameter to the Form Data Model is bound to the Request Attribute and its binding value is set to "
accountnumber". Refer to the screenshot below.
- Drop the
accountnumbers. xmlfile into the C:\RenderPrintChannel\input
- Check the pdf files in the
savelocation as specified in the ECMA script.
- Configure Tomcat for your data source.
- Create the data source.
- Create Form Data Model.
- Create Layout For Print Channel.
- Create Document Fragment.
- Create Interactive Communication Document.
- Add text and image content to document.
- Adding Account Progress Chart.
- Adding Account Balance Table.
- Using Watched Folder to batch generate.
- Opening Agent UI on Form Submission