Archive for October, 2010

Acrobat X and XFA 3.3

By now you will have noticed the announcements for Acrobat X — which promises to be a very nice upgrade on the Acrobat and Reader product lines.  Acrobat X includes XFA version 3.3.  In this blog post I will give you an overview of the new features that have been added to XFA forms.

Designer Version

As usual, LiveCycle Designer is bundled with Acrobat Pro. This Designer is the version that went out with the most recent release of LiveCycle.  i.e. this is Designer 9 a.k.a. Designer ES2 — plus some bug fixes. This version of Designer is able to target the features introduced in XFA 3.0 (Acrobat/Reader 9.1).  If you need a refresher on exactly what features this includes, your can search for "XFA 3.0" on this blog and you will find them described in some entries back in April 2009.

Perhaps more importantly, this is the version of Designer where we introduced the experimental macro feature — first described here.

In order to target the new XFA features introduced in Acrobat X (XFA 3.3) you will have to wait for a new version of Designer to be released with LiveCycle.

Now on to the new features added to XFA 3.3 / Acrobat X.

Flash in XFA

Probably the most exciting new capability in this release is the ability to embed flash objects in an XFA template.  This means your interactive forms may now share their data with charts.  You can embed instructional video. You can introduce a slider widget. A new pop-up widget selector dialog. Have fun. 

Implementation

Surprisingly, we did not introduce any new markup to support embedded flash objects.  We resurected a part of the grammar that was not in active use: the exObject element. Flash content will be defined in the context of a host field where the ui element is an exObject e.g.:

<field>
  <ui>
    <exObject classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" 
              codeType="application/x-shockwave-flash" 
              archive="<uri reference to primary SWF resource>"/>
  </ui>
</field>
            

The rest of the parameters (flashvars, playcount, speed, embedded/windowed, poster, etc.) will be defined as content below the exObject element.

The host field will determine the size and positioning of the flash object (when it’s not displayed in a floating window).

If you are embedding flash in PDF today, you save data/state using ExternalInterface:

ExternalInterface.call("multimedia_saveSettingsString", "save to data or formstate");
state = ExternalInterface.call( "multimedia_loadSettingsString" );
            

For SWFs that are embedded in an XFA form, these calls will save/load the host field data – which will be persisted in the XML form data or form state when the field is not bound.

The XFA object model has 3 new methods:

field.ui.exObject.setState(state) // state is either "activate" or "deactivate"

field.ui.exObject.getState();

// call an Actionscript method exposed via ExternalInterface
field.ui.exObject.invoke(methodName, arguments);

ActionScript can call into form JavaScript in this form:

ExternalInterface.call("foo.bar", "parameter 1 data", "parameter 2 data");

This will call the bar() method in the script object "foo" and pass in the two provided parameters.

There are many more details you will want to know about eventually, but these are the basics.

RTL Subforms

In order to provide better support for right-to-left languages (Arabic, Hebrew), subforms may now flow in a right-to-left direction.  In addition, subforms and exclusion groups may now also specify a horizontal alignment so that content rendered top-to-bottom can be aligned on the right hand side of the parent subform.

Implementation

The new grammar to support RTL functionality is on the subform element:

<subform layout="position | tb | lr-tb | rl-tb | table | row | rl-row" 
     colSpan="1" columnWidths="..." 
     hAlign="left | right | center | justify | justifyAll" >
    ...
</subform>
            

Bulleted and Numbered Lists

The subset of xhtml markup supported in the XFA grammar has been expanded to include the <ol>, <ul> and <li> elements.

XML Encryption

There are now options to leverage the W3C XML encryption standard (http://www.w3.org/TR/xmlenc-core/) with the form data.  The form author can choose to encrypt fragments of data or the entire data set.

Forms that submit XML data can encrypt their data before submission so that it is secure until decrypted by the recipient. 

Implementation

Encryption is managed by a new <encryptData> element that can appear below the <event> and <submit> elements. 

Restrict Console

There are new viewer preferences that will disable the console and JavaScript debugger for specific forms.  There is new configuration grammar that will set these viewer preferences when a PDF is generated from an XFA definition.

Deprecate Legacy Rendering

Ok, this is not an enhancement, but something you ought to be aware of.  Forms that are authored with a target version of XFA 3.3 can no longer be rendered with legacy rendering.  Legacy rendering will continue to be supported for all previous versions.

Legacy rendering was used to bridge the transition of XFA 2.5 (Acrobat
7, 8) documents forward. Having extended the bridge to Acrobat 8.1, 9.0,
9.1 and 9.2 it is no longer needed for Acrobat 10.

Version Correlation

In case you needed a score card, here is the history of XFA and Acrobat/Reader versions:

XFA Version Acrobat/Reader
2.1 6.02
2.2 7.0
2.3 7.0.1, 7.02
2.4 7.0.5, 7.0.7
2.5 8.0
2.6 8.1, 8.1.1
2.8 9.0
3.0 9.1, 9.2, 9.3
3.3 10.0