Flex meets LiveCycle Forms…

Similar to my previous ColdFusion sample that uses LiveCycle Forms, this is part 1 of a Flex and LiveCycle Forms sample.

The goal of this sample is to demonstrate how you can create a Flex application that can use LiveCycle Forms to render PDF and HTML forms from XML form templates (XDP) created in Adobe Designer. The Flex application will display a list of pre-designed forms, sample xml data files (that can be used to pre-populate the forms) and available transformations. Once a form and optional XML data file have been selected, click on the Render Form button. This will make a call to LiveCycle Forms which will render the form on the server and return the result to the Flex application. Since Flash cannot embed PDF or HTML, I have lifted Christophe’s IFrame sample. Basically, the PDF and HTML content returned from LiveCycle Forms is displayed in an IFrame on top of Flash. There are still some issues I have to work out regarding re-sizing etc. I’ll post an update as soon as I have time to look into it.

An optional part of this sample is to display performance numbers. When LiveCycle Forms is rendering the form template into PDF or HTML, I collect the number of milliseconds that it took to render the form. That performance data can be pushed to the flex application using JMS. This option is turned off by default, please read the README.HTML file to see what needs to be done to turn this option on.

This sample will showcase several Flex Data Services 2 capabilities. The first one being RPC Services. This sample uses a Java Object named FileUtils that I created that implements several file I/O functions. One of these function is listFilesFromURL(url). This function will return a string array of files available at the provided URL. That is the function that is used to display the list of available forms and XMl data files. This function was tested with JRun as well as WebLogic directory listings. If there any issues with the code, let me know. The other Flex Data Services 2 capability showcased in this sample is real-time messaging. If you choose to enable the JMS capabilities of this sample, everytime a form is rendered, the performance data is sent to a JMS topic and Flex will detect that message and grab the value which will be displayed in the graph. The really cool thing about this feature is that every person running this application will see all of the performance data, not just their own.

You will need LiveCycle Forms as well as Flex Data Services. Check out these links to get access to the software.

Get the LiveCycle Developer Toolbox 

Get Flex Data Services 2 Trial

I’m working on getting the application hosted somewhere accessible to you can try it… Stay tuned.

Sample Installation Instructions

Download the Sample Files

Comments Closed

5 Responses to Flex meets LiveCycle Forms…

  1. Zee says:

    Thanks for the awsome sample, Marcel. I wish I could build something cool like this.I have tried this on a jboss server and I noticed there were a few hard coded URLs in LCFFlex/main.mxml. A quick tip for those who are not running JRun, flex data services lets you quickly recompile mxml on the server. So all you have to do is to fix those paths in the main.mxml and hit it from a browser (http://localhost:8080/flex/LCFFlex/main.mxml).

  2. Satish says:

    Thanks for example Marcel. When i try to invoke the webservices i am getting following error.Can you please let me know what could be cause of the error .12/18 16:02:25 error loader constraints violated when linking javax/xml/transform/Source classjava.lang.LinkageError: loader constraints violated when linking javax/xml/transform/Source classat com.adobe.formServer.utils.XMLUtils.transformToBytes(XMLUtils.java:592)at com.adobe.formServer.utils.XMLUtils.toXML(XMLUtils.java:568)at com.adobe.formServer.xmlapi.FSXMLConfig.CreateRequest(FSXMLConfig.java:228)at com.adobe.formServer.client.SOAPClient.renderForm(SOAPClient.java:188)at LCFFlex.RenderFormServlet.doGet(Unknown Source)at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91)at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:259)at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:541)at jrun.servlet.http.WebService.invokeRunnable(WebService.java:172)at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)I am running the livecycle Sandbox bundled with Jboss.Thanks in advance for the help.

  3. Robert Hirst says:

    This is a really handy technique for enriching Flex applications.I should issue a few words of warning of issues I’ve encountered so far with the technique:The first issue I’ve come across is that it appears not to work on many linux distros, as the latest Flash Player implementation always renders on top of the other content (even the front page at adobe.com appears broken in my browser!), and in the technote (14201) about the issue there is no indication that a solution is on the way for Linux users.If a client did ask if this could be done so it would work on Linux I’m sure the Flex portion could be stuck in a IFrame and resized so as not to overlap the PDF IFrame. This which wouldn’t be as tightly intregrated within the flex app but would still be functional.Another slight problem is that I tried it on a laptop with a modified font size setting (DPI adjusted to 120) and the IFrame was in the wrong place. Perhaps someone has already found a css hack to fix it? Otherwise once I’ve tackled a few other issues I may come back look to that problem.All the best,RH

  4. Silvio says:

    Hi Marcel, we realized a flex-app simular to yours. Now we have the problem to get the rendered (and possibly user-changed – forms!) pdf out of it, for instance to store the documents in a document-management-system. Do you have an idea how this could be done?