Avoka Blog: Adobe LiveCycle

July 8, 2008

Form Guide Rendering Explained – Part II

Filed under: LiveCycle, LiveCycle Architecture — htreisman @ 6:12 pm

A number of people (Gareth and Mark from Adobe – thanks guys) indicated that the first blog on this topic was correct, but incomplete.

Here is the rest of the story…

Q: What is an orchestration?

A: An orchestration is really a LiveCycle process that runs as if it were really just Java code. You design an orchestration by dragging a series of steps into a “short-lived” process, and joining those steps together using lines. Each step is really a method call on an object, and the process engine simply follows the lines, and executes each method call in the correct order. It’s basically visual programming.

You can invoke an orchestration from Java or C## or other code, via SOAP, from another orchestration, etc. When you call it, it’s almost identical to calling a real Java program, except that:

  • The logic of the code is visible graphically
  • It can be maintained and modified by non-programmers
  • It’s much easier and quicker to change
  • It runs a teeny bit slower than if you’d written the code in Java

There is a sample orchestration for rendering a Form Guide as a step inside of LiveCycle Workspace – you can refer to that if you want to take a closer look at both an orchestration, and also an orchestration rendering a Form Guide.

Q: What if I’m using the feature where you can switch between the Form Guide and a PDF?

A: Well, things do get a little more complicated.

Form Guide With PDF

Form Guide With PDF

In this case, a few extra things happen:

  1. After loading the SWF file, the SWF file checks to see whether the minimum version of Reader/Acrobat is available.
  2. If so, creates a new, hidden DHTML iframe.
  3. Into the iframe, it loads a URL that points back to the LC Forms servlet.
  4. When invoked, the servlet in turn invokes the LC Forms Render process. It supplies different parameters, this time requesting a PDF to be returned, rather than SWF.
  5. The PDF is returned to the hidden iframe.
  6. The Form Guide enables a button that allows the end user to toggle between the Form Guide and the PDF view.
  7. When the user clicks the PDF toggle button, the Form Guide extracts the current state of the XML contained in the Form Guide, and dynamically injects it into the PDF.
  8. The Form Guide then hides itself, and displays the iframe containing the PDF.
  9. When the user toggles back, the current value of the XML is obtained from the PDF, and injected back into the Form Guide, and the hide/show happens.
  10. Voila

Notes:

  • The injection of XML data into the PDF is achieved using something called the Form Bridge, which is a combination of JavaScript in the form itself, and some Javascript in the iframe. This basically allows the Form Guide to communicate to the PDF. You can either manually insert the Form Bridge into your form (in Designer, look for it in the Custom palette), or you can dynamically inject the Form Bridge into your form in the orchestration, using a service called the Form Augmenter.
  • Like the generation of the Form Guide SWF itself, the PDF will also be cached by LC Forms – on subsequent invocations, the PDF will be obtained from the cache.

Please click on the “Comments” link for some excellent additional material – a big thank you to John for contributing.

Advertisements

3 Comments »

  1. There are a few more notes to add that might make it easier to get started with Form Guides:

    1. The Form Guide displays a toolbar at the top of the Guide called the PDF Toolbar. This toolbar contains buttons to e-mail the PDF, save the PDF to disk (you must Reader Extend the form if the client only has Adobe Reader), print the PDF and toggle between the PDF view and the Form Guide view.

    For this toolbar to appear, Acrobat / Reader must have the option “Display PDF in browser” turned on (Preferences -> Internet).

    2. You are not limited to J2EE servers in your DMZ. You can easily replace Apache with IIS in the “real life” diagram in the first post – writing a pass through / proxy script would only take about 10 lines of code. The LiveCycle server can easily be treated as a black box in a Microsoft hosting environment.

    The only other caveat is that with LiveCycle 8.1, you must also have a copy of the Flash detection kit installed on your front line servers available at /FormServer. For IIS servers, you must modify the function AC_AddExtension in AC_OETags.js in the Flash detection kit so that the extension (.swf) is always appended to the request.

    3. You don’t HAVE to use orchestration if you don’t want to implement / learn a workflow system (although it is a damn good idea to use orchestration!). You can call any LiveCycle web service directly from within your code – the LiveCycle Quickstarts provide great examples on how to setup your development environment and call LiveCycle web services directly using Java or C#.

    However, if your project is likely to have changing requirements you should explore orchestration as you can expose your process as a web service and call it as easily as you would the LiveCycle web services. The advantage is that you can dynamically change how the form is generated and what data is used for pre-population without re-coding, recompiling and redeploying your application.

    Comment by John Nesbitt — July 10, 2008 @ 12:56 pm

  2. Is there a way to invoke the toggling between PDF and form guides via Javascript embedded in your form/Form guide?

    Comment by Steve Lundy — November 5, 2008 @ 2:13 am

  3. Hi Steve
    I’m pretty sure there is some way of doing it, but I haven’t investigated this myself. Anyone?
    Howard

    Comment by htreisman — December 6, 2008 @ 5:08 pm


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: