CRX Connector for LiveCycle ES2

DSC Version : 1.0
Download URL : Click here to download
Apache Jakrabbit API : Click here to download the API

Recently created a new DSC to connect to CRX 2.2 Server from LC ES2 & ES2.5. The Service has three operations namely:

  1. createNode – creates a new node in CRX repository
  2. storeContent – upload documents to the CRX repository
  3. removeNode – deletes Node and its SubNodes from the repository

CreateNode operation requires two mandatory inputs ‘Absolute parent path’ & ‘Node name’ and returns the Absolute path of the newly created node as output. There is no overwrite option available for now (will update this feature later).

StoreContent will require the Node path (Absolute path) under which the file must be uploaded. To confirm with the CRX hierarchy, this opeartion will create a new node under the parent node and set the primaryType property to nt:file. It will also create another node called jcr:content and set the jcr:data property with the given binary value (com.adobe.idp.Document).  The file can be overwritten if the node is already exisits.

RemoveNode will simply delete the node from the CRX repository. If the given absolute Node Path is  invalid, the operation will return false, otherwise it will delete the node and return true.

Deployment Instructions

  1. The DSC JAR is embedded as file attachment in the uploaded PDF.
  2. Open the PDF and download the attached JAR from it.
  3. Login into LiveCycle Workbench ES2 / ES2.5 and goto Window menu -> Show View -> Components
  4. Right click on the Components root node and select Install component
  5. Browse the JAR file saved on your computer
  6. Right click on the Installed component and chooese Start Component. This will auto-deploy the service.
  7. Download the Apache Jakrabbit API (jackrabbit-standalone-2.4.1.jar file) from the URL given at the top and deploy it in Application Server.
  8. Restart the Application server to make sure the API is loaded
  9. The CRX connector is now ready to use

Feel free to explore the source code packed as part of the JAR and  provide your valuable feedback.

Enhancement Plans:
1. Checkin / Checkout operations
2. Property update operation
3. Operation to check if a Node is existing in the repository or not
4. Operation to search for documents using SQL2 queries

Nithiyanandam Dharmadass

Posted in Custom DSC Library | Leave a comment

Import Excel Documents into LiveCycle forms

Use Case

Many of the LiveCycle developers finds it difficult to import data from Microsoft Excel documents into Adobe LiveCycle interactive PDFs. This article explains how to import a range of cell’s data from MS Excel into PDF dynamically.

The Solution
It’s relatively easily to convert the Excel document into XML using Apache POI API. Once the XML is constructed in a specific format, it can be imported into PDF/XDP using ImportData activity.

The Excel to XML conversion code can be written within a Script Activity, Web Service, or Custom DSC. I preferred writing a custom DSC which can be easily deployed into multiple environments.

The Custom DSC Source Code
Do not forget to download the Apache POI API for Excel Documents processing. Once you download the .JAR file, copy it into the lib folder of your Application Server (e.g. JBoss)

Create a Custom DSC project using Eclispe or Netbeans IDE

Write the following lines of code in the component (JAVA file)

import org.apache.poi.hssf.usermodel.*;
import org.w3c.dom.*;
import javax.xml.parsers.*;

public class ConvertExcel2XML {
public org.w3c.dom.Document ConvertExcel2XML(com.adobe.idp.Document inputDocument,boolean UseFirstRowAsColumnName)throws Exception
InputStream is = inputDocument.getInputStream();
HSSFWorkbook book = new HSSFWorkbook(is);
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder parser = factory.newDocumentBuilder();
Document xml = parser.newDocument();
Element rootElement = xml.createElement("ExcelContent");

for(int i=0;i<book.getNumberOfSheets();i++)
Element sheetElement = xml.createElement(book.getSheetAt(i).getSheetName().trim().replace(' ', '_'));
for(int j=UseFirstRowAsColumnName?1:0;j<book.getSheetAt(i).getPhysicalNumberOfRows();j++)
Element rowElement = xml.createElement("Row");
for(int k=0;k<book.getSheetAt(i).getRow(j).getPhysicalNumberOfCells();k++)
Element cellElement = xml.createElement(UseFirstRowAsColumnName?book.getSheetAt(i).getRow(0).getCell(k).getStringCellValue().trim():"Cell"+(k+1));
Text text = xml.createTextNode(book.getSheetAt(i).getRow(j).getCell(k).getCellType()==0?book.getSheetAt(i).getRow(j).getCell(k).getNumericCellValue()+"":book.getSheetAt(i).getRow(j).getCell(k).getStringCellValue());
return xml;


I hope the above code is simple and self-explanatory.
Create the Component.xml file and build the project.
Deploy the compiled JAR file into LiveCycle server.

  • Goto Workbench ES2 -> Windows Menu -> Show View -> Components
  • Right click on Component and click Install Component
  • Browse the JAR file
  • Right Click on the Excel Service and click Start Component

You are ready with the newly created service running.

Utilizing the Excel2XML Custom DSC
The Excel2XML Service has one operation named ConvertExcel2XML. This operation accepts two parameters and returns an XML document.
Input Parameters:
inputDocument – denotes the required Excel document
UseFirstRowAsColumnName – denotes if the first row of the excel sheet must be ignored or considered as column names
Output Parameter:
xml – denotes the XML document converted from Excel

Please the Excel2XML service into a workflow and set the required input and output parameters.
Use the output value to import into PDF of XDP forms.

— Your comments and feedback on this article are highly appreciated —

Posted in LiveCycle ES2 Articles | 2 Comments