Archive for September, 2008

Correspondence Management

To find out more on the Correspondence Management Solution Accelerator, you may read the following existing articles. Please note that future CM-related articles will be posted on this blog rather than the LiveCycle Product Blog.

About the CM Solution Accelerator

Letter Building Tutorial

How do I make sure this paragraph is included in my letter only if the user selects this other paragraph?

Unveiling the Dynamic Document Generator …

In this post, I’ll brief you on what you can actually do with our technology – Dynamic Document Generator (DDG), delivered as part of the Enrollment Solution Accelerator kit. This component comprises of a taglib which provides JSTL implementation along with a rich collection of custom tags that facilitate various XFA manipulation operations like dynamic stitching of templates, merging data into templates, generating interactive/non-interactive PDFs and assembling documents dynamically.

It is true that XFA language itself supports the notion of form stitching using data nominated subform or subformset. However, the XFA approach requires the form designer to be aware of the data XML structure and design the forms such that the data nomination could be used by the XMLFM engine. DDG eliminates this requirement and thus the form designers can focus on content creation, whereas the application developer can concentrate on writing the decision making logic and more importantly, both can work in parallel.

DDG supports two artifacts:
   • DXFA (Dynamic XFA)
   • CSC (Content Selection and Composition)
These are JSP based files which integrate seamlessly with client web applications. The decision support as well as other programming language constructs like looping can be encoded in these files using the well established JSTL tag based expression evaluation capabilities. The DDG taglib provided custom tags can be used to model complex document generation logic in a simplified manner.

With that said and assuming that you have LiveCycle installed and setup, with at least Forms, Output and Assembler services deployed, I’ll step you through creation of DXFA and CSC files.

Authoring DXFA files

In a nutshell, include our custom taglib and the standard jstl taglib, write a series of lc:include and lc:alter tags within the lc:render tag along with standard jslt looping and conditional constructs like c:if and c:foreach to specify business rules and template selection logic. Package the dxfa file into the web application, deploy and run. The required templates or fragments should ideally be placed in the LiveCycle Repository. Alternately, they could be included within the Web Application or on a local directory.

To create a DXFA file for generating a CreditCardEnrollment form, some of the requirements would be:
   • There can be two types of credit cards that one can apply for – Silver or Gold.
   • Based on the Card Type, the enrollment form’s header and footer would vary.
   • If the applicant is a minor, an additional section eliciting Parent/Guardian
      information to be included in the enrollment form.
   • There are some mandatory sections like a product features section which must
      always be included.
   • Certain inputs like card type, name, age – taken as input (using an HTML or Flex
      based client) from the applicant should appear pre-populated in the form.

In a JSP editor or a text editor, create a “.dxfa” file and

  1. Include the lc and jstl taglibs.

      <%@ taglib uri=”” prefix=”lc” %>
      <%@ taglib uri=”” prefix=”c” %>

  2. Set the render format to either XDP, PDF, PDFForm or PDFA.

     <lc:render format=”PDFForm”> … </lc:render>

  3. Include the container template using include tag. All contents of the template
      need to be included so specify the select attribute as ‘/xdp’.

    <lc:include type=”repository” ref=”/content/Container.xdp” select=”/xdp”> …

  4. Stitch the required templates using include tag. Like, product information:

     <lc:include ref=”/Templates/ProductInfo.xdp” type=”repository”> …         </lc:include>

  5. Pre-populate data into relevant template using the setvalue tag.

     < lc:include ref=”/Templates/PersonalInfo.xdp” type=”repository”>
        < lc:setvalue name=”firstName” value=”${param.firstName}”/>
        < lc:setvalue name=”middleName”
        < lc:setvalue name=”lastName” value=”${param.lastName}”/>
        < lc:setvalue name=”Age” value=”${param.Age}”/>
        < lc:setvalue name=”SSN” value=”${.param.SSN}”/>

  6. If the age of the applicant is less than 18 years, include an additional template for
      parent/guardian information

     <c:if test=”${requestScope.paramsmap.Age<18}" >
       <lc:include type="repository" ref="/Templates/ParentInfo.xdp">

  7. Package the dxfa file into your web application and deploy it. You could also
      include your templates and dxfa files into the sample web application
      (DDGSample.war) provided as part of the kit and get going.

     Click here to download the complete DXFA file.

CSC in 10 Seconds

Let me now give you a quick rundown of CSC (Content Selection and Composition) concept. Basically, this component brings dynamism into LC Assembler. CSC file contains following sections:
  1. DDX section
  2. File section, which contains list of documents that could be used within DDX.
Since CSC file itself is a JSP, the same JSTL and DXFA tags can be used to decide at the runtime which documents to be used for assembly.
E.g. If I require to create a PDFPackage which is say, an Information Kit for buying a product, then I would create the CSC file as follows:

  <%@ taglib uri=”” prefix=”lc” %>
    <lc:doc key=”productbrochure” type=”url” ref=”content/productbrochure.pdf” />
    <lc:doc key=”termsofuse” type=”url” ref=”content/termsofuse.pdf” />
    <lc:doc key=”privacypolicy” type=”url” ref=”content/privacypolicy.pdf” />
    <lc:doc key=”faq” type=”url” ref=”content/faq.pdf”/>
    <lc:doc key=”ProductOrderForm” type=”dxfa” ref=”orderPackage.dxfa”/>
      <DDX xmlns=””>
      <PDF result=”resultDoc”>
          <PDF source=”productbrochure”/>
          <PDF source=”termsofuse”/>
          <PDF source=”privacypolicy”/>
          <PDF source=”faq”/>
          <PDF source=” ProductOrderForm “/>

The PDFPackage would include product information documents like, “productbrochure.pdf”, “termsofuse.pdf”, “privacypolicy.pdf”, “faq.pdf” and a purchase order form which gets generated by the DXFA named “orderPackage.dxfa”.
Package this CSC into your web application and hit the URL.

Bookmark this page for more DDG examples and features !!!