Author Archive: Raghavendra Pandey

Scribble your forms

With new Mobile Forms, it is much easier to customize the forms than ever. In this post, I will cover one such improvisation that Mobile Form provides out of the box. Mobile Form extends image field to provide a scribble control on the form. The users can scribble any useful drawing, for example their signatures to the form. This control comes in the livecycle ES4 designer out of the box. Due to its close proximity with paper signature, we call it signature scribble. So here is how you design a form with scribble.

Open any existing form or a new form in LiveCycle ES4 Designer. Drop in signature  scribble object from the Object Library pane as shown below:

designer_scribble

 

Once you open the form in browser you will see the following UI experience. You can scribble anything using the brush and save it. This control is only available for mobile forms. In pdf world this will be treated like an image and you don’t see any interactivity with that image.

capturesave

Mobile forms Vs Pdf forms

Mobile forms component enables XFA forms on mobile devices. The same XFA form that can be used for generating pdf, can be used to generate html form as well. The html version should behave almost exactly same as the pdf version. XFA has a very rich support for scripting. It supports tons of APIs and almost all the properties are exposed via scripting interface. But as the famous 80-20 rule suggests our customers use only 20 % of that capability. The difficult part was to find those script constructs that are used in real world cases and prioritize them higher than the rest of the script constructs. We have run through the large collection of customer XDPs we have and generated the list of javascript constructs that people use. Interestingly, we found that usage to be less than 20%. Out of 2600 javascript object properties and APIs, forms were using around 200 constructs at least once. So we decided to prioritize based on it.  Mobile Form is covering that gap fast but there would be certain things that would never make sense in html or mobile world.

Here is screenshot of both pdf as well as html form for comparison.

pdf_form

 

 

html_formThen there are things that matters in pdf world doesn’t have same importance in html/mobile world, e.x. barcodes. Barcodes are more relevant in printed documents so we decided to do away with this barcode object purely from UI level. We still keep it at model level so one can always generate pdf with barcode using the data exported from the html form. If required, one can always insert custom widgets to show barcodes on html form. That is the beauty of Mobile Form architecture. It is way more open than the pdf form where all the widgets are locked down. In Mobile Forms world, one can customize the widgets to enhance the user experience on Mobile devices. For example, one can replace the xfa numeric field with the slider object to capture number information from users.

Signature field is another component that can be interestingly done using the html world solutions like e-sign. So we decided to de-prioritize it for Mobile Forms. On the other hand, we provide a scribble object, using that one can scribble his signature on the form and it will be saved as an image on the form. More detail on the scribble form can be found here.

As I mentioned, Mobile Form will look like almost same as Pdf form. Time has come to explain the almost part here. Mobile Form, because of its html nature has lot of advantages, for example easier to customize, faster opening time, availability on mobile etc. But it has its own set of inherent issues also like support for very thin lines thinner than 1 px.

We use data uri scheme to show images in the Mobile Form. This is supported by all the modern versions of the browsers but you cannot help but notice the differences in the range of image formats that these browsers support. So one should test the images across all the browser matrix before deploying the forms.

In mobile form, pagination, the ability to generate pages due to content changes like adding enough text in the text box to go beyond page boundaries, doesn’t matter. But keeping all the content cluttered would not look nice either. Mobile Form, that is why, chooses a hybrid approach where it generates panels, a box to give feel of pages, as many as there is in the template but it doesn’t increase or reduce panels by data content merged or by user content.

 

Forms Management

This is second post in my previous series of LiveCycle Mobile Forms. In this post, I will introduce utility tool called Forms Management that eases out forms deployment on live production systems.

The Forms Management streamlines the process of updating, managing, and retiring thousands of forms and the business users can manage forms without any help from IT support.

One can access Forms Management console through http://<server>:<port>/lc/fm. Here is how it looks like once you log in using super admin user.

fm

 

There is search control where one can search through the forms. Forms Management UI shows all  LiveCycle applications that contains forms. You can go and select one of the applications and browse into the forms. You can select the forms and preview it as pdf or html5. Here is how preview screen looks like:

 

FM_Preview

You can select a form and edit metadata corresponding to it and the metadata is searchable too.

LiveCycle Mobile Forms

One of the many new offerings in LiveCycle ES4 is Mobile Forms that is ability to display and fill forms on mobile devices like iPad and other tablets. Mobile forms uses the already stable and widespread html5 as its rendering format so practically, any device that supports html5 can show LiveCycle forms. With the explosion of mobile devices, our existing customers were looking for this component to increase their reach and not only that, it would also enable many new use cases. Mobile Forms plays key role in customer’s workflow and enabling that workflow step on mobile device will further reduce the time taken to complete the process.

Mobile Forms generates html5 document for XFA forms. The API is RESTful, another change from the Document based LiveCycle service APIs as html is more suited for http requests. Html fragment for XFA form can be embedded into any html document.

“Web” and “online” are two closely associated terms, downright synonymous to many people. But with the advent of html5, now people are developing offline web apps. Mobile Forms, being an html5 document, can also be used to build offline forms.  So one can open the form even if she is not connected to company intranet or for that matter internet. Mobile Forms closely follow the html5 offline W3C spec for building offline-able forms. I’ll discuss this feature in detail in some other post. Let’s focus on html5 form render first.

As I mentioned Mobile Forms is a RESTful application and its render API has the following commonly used parameters to specify form and data:

Parameters Description
template This parameter takes the file name of the template.
contentRoot This parameter is for specifying the path where template and associated resources resides.
dataRef This parameter takes absolute path of the data file to be merged with the template. Please remember it takes absolute value of the data file path.
data This parameter takes UTF-8 encoded data bytes to be merged with the template.
submitUrl The url where the form data will be posted to.
debugDir Directory location on server machine where the debug intermediate files will be dumped. Do not use this parameter in production as it will slow down the rendering considerably. This parameter is for Adobe internal usage and can be changed in the future.
templateBytes This parameter takes UTF-8 encoded template bytes to be rendered. This is again Adobe internal API and can be changed in future.


As you can see, Forms Mobile render API is fairly simple and can be easily used. Out of the box, the render API is exposed on both GET and POST. The sample uri looks like the following:

http://<lcserver>:<port>/lc/content/xfaforms/profiles/default.html?contentRoot=c:/xdps&template=sampleForm.xdp

Hit the above URL in browser and see your XFA forms being rendered as html5 document. XFA forms can also have webservices or scripts that are to be run on server side. In that case, the rendered html doc contacts http://<lcserver>:<port>/lc/content/xfaforms/submission/default.html url so make sure you don’t block this url while hardening the system in order to smooth functioning of form.

 

In the next post I’ll cover how to quickly test the forms.

 

 

Mobile Form Configuration

Caching in Mobile Forms or any solution for that matter, plays key role in the performance. On the other hand, cache takes finite space to store intermediate artifacts that means you trade memory for better performance. In Mobile Form solution, we have exposed different strategies of caching to fine tune this trade off. I’ll first describe all the levels and what do they mean and then how to change the levels.

Mobile Form has 3 different strategy of caching that can be controlled using the configuration.

Cache Strategy Description
None This cache strategy enforces the solution no to cache any artifact. This will, in practice, slow performance and high memory availability due to absense of cache.
Conservative This cache strategy dictates to cache only those intermediate artifacts that are generated before the render of the form like template containing inlined fragments and images.
Aggressive This cache strategy enforces the solution to cache almost everything that can be cached. This includes rendered html content besides all the artifacts from Conservative level. This should result in best performance but it will also consume more memory for storing all the cached artifacts.

Aggressive caching strategy means you will get O(1) or constant time performance in rendering a form as rendered content of the form is cached.

The following section describes how to change the caching strategy based on you requirement:

  1. Go to  http://[server]:[port]/lc/system/console/configMgr and look for “Forms Configuration” and click on it. You see a dialog like following:
  2. You can select Cache strategy using the drop down.

 

CacheConfig

 

Besides Cache strategy, one can also configure total in memory cache size and the upper bound on the size of the individual artifacts to be cached. HTML Forms, as of now, only do in-memory caching using LRU strategy.

If you select ‘None’ cache strategy, the cache gets cleaned up.

All about embedding font in the document

 

Some designers wish to include only a few specific fonts in a PDF to ensure all possible end-users have access to those fonts, especially if the fonts are uncommon. Some other designers wish to embed fonts, but exclude fonts that they know exist on their end-users’ systems.

Adobe LiveCycle Forms and Output both supports these kind of use cases. This blog posts demonstrates how to do that. There are two constructs in XCI (configuration packet of XDP) to support this alwaysEmbed and neverEmbed. The following examples show this.

Example 1: How to use alwaysEmbed

In this example, a form uses the fonts “FontIsRare”, “FontIsCommon”, “FontC”, and “FontD”. Given the following in the configuration:

</fontInfo>
    <embed>0</embed> <!- - embed is off - - >
    <alwaysEmbed>FontIsRare</alwaysEmbed>
    <neverEmbed>FontIsCommon</neverEmbed>
</fontInfo>
The output file is expected to have only "FontIsRare" embedded.

Example 2: How to use neverEmbed

In this example, a form uses the fonts “FontIsRare”, “FontIsCommon”, “FontC”, and “FontD”. Given the following in the configuration:

 

<fontInfo>
    <embed>1</embed> <!- - embed is on - - >
    <alwaysEmbed>FontIsRare</alwaysEmbed>
    <neverEmbed>FontIsCommon</neverEmbed>
</fontInfo>

The output file is expected to have “FontIsRare”, “FontC”, and “FontD” embedded. “FontIsCommon” is not embedded.

 

The fontInfo element may appear in the configuration file as a child of pdf, pcl, zpl, ps, and image. The elements alwaysEmbed and neverEmbed will only be meaningful under the pdf element and will not be meaningful for image, pcl, zpl, and ps, the reason being that there is no support for adding non-embedded fonts that are not recognized by the printer in pcl, zpl and ps.

alwaysEmbed is only honored if embed is set to ’0′.  Here is how your full xci file look like:

<xfa xmlns:xfa="http://www.xfa.org/schema/xci/1.0/">
    <config xmlns="http://www.xfa.org/schema/xci/1.0/">
        <present desc='Presentation Agent'>
        <pdf> <!--  [0..n]  -->
            <fontInfo>
                <embed>0</embed>
                <alwaysEmbed>Wingdings</alwaysEmbed>
                <alwaysEmbed>Book Antiqua</alwaysEmbed>
                <alwaysEmbed/>
                <neverEmbed>Wingdings</neverEmbed>
                <neverEmbed>Book Antiqua</neverEmbed>
                <neverEmbed/>
            </fontInfo>
         </pdf>
        </present>
    </config>
</xfa>

 

 

Merging image data into a XFA template

There are many cases when a user may need to specify the image contents via a data file. Let’s take a simple hypothetical example. Say you are a company that specializes in printing purchase order forms for a number of customers. The form is designed once and it’s the data merged into the form that dictates the final format. Part of the data loaded in could be the customers company’s logo.

The Data File

or an image, there are two ways to specify the content.

  • Link
<image xmlns:xfa="http://www.xfa.com/schema/xfa-data">
<FFGraphic1 xfa:contentType="image/jpeg" href="C:\Sample.jpg"></FFGraphic1>
</image>
  • Embedded
<image xmlns:xfa="http://www.xfa.com/schema/xfa-data">
<FFGraphic1 xfa:contentType="image/tiff" xfa:transferEncoding="base64">
SUkqAAgAAAASAP4ABAABAAAAAAAAAAABAwABAAAAqQAAAAEBAwABAAAAwgAAAAIBAwADAAAApAIA
AAMBAwABAAAAAQAAAAYBAwABAAAAAgAAAAoBAwABAAAAAQAAABEBBAAEAAAAQIMBABIBAwABAAAA
...
AMp6AADKegAA2A8AAPgCAADCfQAAjPgAAFZzAQA=
</FFGraphic1>
</image>

In both cases the contentType attribute MUST be specified. If not specified, it will default to ‘text/plain’ and likely result is that the image will not be rendered. During the merge process, the contentType of the data is overrides the contentType specified in the template in order to coerce the field to the data contentType.

Note the xfa: namespace prefix is required for the contentType and transferEncoding attributes.

The Template File

<?xml version="1.0" encoding="UTF-8"?>
<?xfa generator="FF99V40" APIVersion="4.0.4200.2002"?>
<xfa>
 <template>
	 ...
	 <field name="FFGraphic1" y="35.56mm" x="81.28mm" w="91.55mm" h="68.53mm" access="protected">
	  <value>
		<image/>
	  </value>
	  <ui>
		<defaultUi/>
	  </ui>
	 </field>
	 ...
 </template>
</xfa>

RFID Label printing

RFID: Radio frequency identification A method of identifying unique items using radio waves. Typically, a reader communicates with a tag, which holds digital information in a microchip. But there are chipless forms of RFID tags that use material to reflect back a portion of the radio waves beamed at them.

Form Authoring

XFA has the capability to handle barcodes since beginning. In Adobe LiveCycle ES1.0, we introduced the support for elementary RFIDs also. It is  handle like any other barcode and named it rfid. The form author can put an rfid object on the label while designing label using Adobe LiveCycle Designer.

RFID set up in Adobe LiveCycle Output

To enable the rfid capability in Adobe LiveCycle Output service, first, the user needs to do rfid set-up based on the target rfid printer. The user has to configure the RFID parameters in the XDC file using Adobe LiveCycle XDC Editor, based on his rfid printer configuration before printing his first rfid label.
There are four device options in the XDC that one needs to configure.

rfidBlockRetries

It controls the number of times the printer attempts to write to a particular block of a single RFID tag. The accepted values for this option is between 0 to 10.
If the user doesn’t specify in its XDC, the printer will take the default value ’0′.

rfidLabelRetries

The number of labels that will be attempted in case of encode/write failure. This number is different from the rfidBlockRetries. The accepted values for this option is between 0 to 10.
If the user doesn’t specify in its XDC, the printer will take the default value ’3′.

rfidTagType

It controls the encoding type of the data in the RFID label. The RFID readers should have same tag type as the rfid printer has. The accepted values for this option varies printer to printer. Consult your printer manual for this. Generally this option takes values between 0 to 5.

value tag type
0 None
1 EPC Class 0
2 EPC Class 0 Plus
3 EPC Class 1 64-bit
4 EPC Class 1 96-bit
5 ISO 18000-06B

These tag types also has some frequency standards. In some countries, some of the frequencies are restricted and in that case the rfid printer might not support those corresponding tag types. In that case the printer will use the default tag type. There are number of other EPC and ISO standards.

rfidTransponderPosition

This is the distance of the microchip on the label from the top. The user needs to pass this value in dots. The accepted values are between 0 to length of the label.
If the microchip is located at the beginning of the label, the user needs to simply set this option to 0.

rfidDataType

This is the setting which will be specified based on the fact whether the data used is HEX or ASCII.

 

Here you go. Once the above set-up is taken care of, you can generate the labels using the generatePrintedOutput API of AdobeOutputService. You can upload the edited XDC file in the Adobe LiveCycle Repository and pass its uri as XDC URI in the API.

 

A quick disclaimer here that RFID capability is supported only for Zebra labels (zpl) and not in PS/PCL or pdf documents generated by Adobe LiveCycle Output.

 

Adobe LiveCycle Central Migration Bridge

Adobe Output Central is a very old product with substantial customer base. Its design was basically watch folder based and it uses very naive string matching to run the customer workflows. The workflow steps can be simple command line invocations of the components of Adobe Output Central or any other executable. The core Adobe Output Central components are:

  1. JFMerge – it merges templates and data to generate formatted document (PDF/PCL)
  2. JFTrans – it converts structured text and overlay text to usable .DAT and XML data. It is also used for touching up existing data as ut contains a rudimentary scripting capability.
  3. XMLImport – it converts XML data to .DAT data.

Besides these Adobe Output Central has other helper utilities like send/read emails. The main goal of this document is to help central clients to move from the rudimentary hosting environment of Adobe Output Central to modern environment of Adobe LiveCycle. Adobe LiveCycle Output Service does similar things as Adobe Output Central. But it uses different data and template models which are xml schema based.

The pricipal problem with current clients moving to or looking to move to Adobe LiveCycle is the time required to transition. It is in the magnitude of 1-2 years. There are basically two things the customers need to do. They have to migrate their Adobe Output Central templates to Adobe LiveCycle Output templates i.e. XFA templates and migrate their Adobe Output Central workflows to Adobe LiveCycle workflows. Though Adobe LiveCycle Designer provides capability to import any Adobe Output Central templates and convert it back to Adobe LiveCycle templates, this proves to be a more time taking than migrating the workflows. In fact, migrating Adobe Output Central workflows to Adobe LiveCycle workflows is very easy with the hosts of services available with the Adobe LiveCycle suite. So if we could keep on using the Adobe Output Central from Adobe LiveCycle environment by migrating the Adobe Output Central workflows, that would give our customers freedom to migrate their Adobe Output Central templates to Adobe LiveCycle Templates at their own pace.

We have created Adobe LiveCycle Central Migration Brige in ES 2.0 that enables the user to call all aforementioned core executables of Adobe Output Central from inside Adobe LiveCycle environment. The other helper utilities of central are either lightly used or can readily be replaced by Adobe LiveCycle Foundation components. Adobe Output Central clients can build new processes using Adobe LiveCycle and over time move their Adobe Output Central based templates to Adobe LiveCycle templates at pace that suits them and their business needs; as well this allows for a small application to be transitioned independent of many others allowing for confidence in transitioning to be gained; rather than us pressing them to big-bang the transition.

Adobe LiveCycle Central Migration Brige exposes 3 different operations one each for each core component of Adobe Output Central. Each of the operation will simply fork the corresponding Adobe Output Central executable as a separate process with suitable commandline options. The Adobe LiveCycle CentralMigrationBridge APIs expose the most frequestly used commandline options as an input parameter to the operations. This component will use the existing Adobe Output Central installation from the same machine where Adobe LiveCycle is installed.

The general execution sequence from the APIs would be something like the following:

  1. Take input from the user and convert them into relevant command line options.
  2. Create a process using ProcessBuilder and pass all commandline options.
  3. The result would contain the output and several meta data files as well.
  4. Return the Result to the user so that he can pass them to the next step of the orchestration.

Besides the three core component of Adobe Output Central Adobe LiveCyle CentralMigrationBridge service will also provide a fourth operation, dataAccess to help customers convert their data models (.DAT file) into XML document that can be xpath’ed into. This will enable the user to process some of the options that is passed to the .DAT file. We’ll also provide a strongly typed client to the customer to help in their further development.

API Description

Signature for the operations of this DSC would be the following:

  1. CentralResult centralDataMerge(Document inTemplateDoc, Document inDataDoc, Document inoutPreambleDoc, String printerDestination, String inIniFilePath, String inAllOtherOptions) throws CentralMigrationBridgeException, DSCException
  2. CentralResult centralTransformation(Document inDataDoc, Document inDataModelDoc, String inIniFilePath, String inAllOtherOptions) throws CentralMigrationBridgeException, DSCException
  3. CentralResult centralXMLImport(Document inDataDoc, String inXCIFilePath, String inAllOtherOptions)throws CentralMigrationBridgeException, DSCException
  4. CentralResult {
    Document logDoc; //log file
    Document responseDoc; //jetform.rsp file
    Document traceDoc; //trace document that can be passed to the API again as preamble (Applicable only for merge API)
    Document resultDoc; //formatted output doc (pdf/pcl) in case of merge API, transformed doc in case of trans API and imported .dat in case of xmlimport
    }

  5. Document centralDataAccess(Document inDataDoc, int inMaxBytesToProcss) throws CentralMigrationBridgeException, DSCException

Error Handling

Adobe LiveCycle CentralMigrationBridge service would throw the following errors:

Error codes Description
ALC-CMB-001-001 If the install directory specified by the user is not a valid Output Central installation directory.
ALC-CMB-001-002 If the central executables has returned with an error code.
ALC-CMB-001-008 Unexpected exception while starting any of the central executable.
ALC-CMB-001-009 Unexpected exception while running any of the central executable.
ALC-CMB-001-010 Execution interrupted while running any of the central executable.

The user can get central logs from the Output Objects returned by the APIs and debug the errors. The complete detail of the error would be in the log document returned by the APIs and not in the LC server logs. LC server logs would contain just the top level exception.

Support for unicode characters on Zebra Labels

In ES2, Livecycle introduced support for arbitrary unicode characters in Zebra Labels. Prior to this only latin-I charset was supported. Though there was support for Asian encoding like GBK(Simplified Chinese), Shift-JIS (Japanese), BIG-5 (Traditional Chinese) and KSC-5601 (Korean) but generic unicode support was missing.

Another pain was LC didn’t allow any font that is not present on the printer, to be specified in the label. This combined with above became a real problem with the middle east customers. The problem with Zebra is one cannot embed fonts inside the document like Postscript as downloading fonts on the printer is awfully slow. So the only option we left with is to rasterize the text and represent it as an image in the generated label. This way, the form author can get what he sees on the screen in pdf or in designer. Even with this approach, we felt that there is considerable file size bloating even after compressing the images of the document. Since XTG was rasterizing all the text present in the font other than the printer, which was not necessary sometime. For example, if the text is specified in english in Arial font, the end user might want to substitute it with the font present on the printer. In fact this is what we used to do before this change.

An option in XDC file is used to map to a font which is to be rasterized. The general font mapping sequence that is allowed in XTG needs both from and to font and along with it one can specify which unicodeRange to target. But here, the form author might not know before hand what data is going to be merged with the form. For example, there can be multiple textfields in the form with different fonts specified. The data to be merged in the form may contain non-english characters for some of the textfield. If the end user wants to map the form font into printer font, she has to specify that many mapping in the config file. So to ease the effort on the end user side, we exposed this option in xdc file where one needs to specify only to font and unicodeRange. This is a shortcut to the existing font mapping sequence.

<xdp>
    <xdc>
       <deviceInfo>
          <option>

            ...

            <!-- ========================================== -->
            <!-- Raster Substitution Font                     -->
            <!-- ========================================== -->

            <rasterSubstitutionFont typeface="CG Triumvirate_Normal_Normal" unicodeRange="U+20-U+FF"/>
         </option>
     </deviceInfo>
   </xdc>
</xdp>

The above entry is shortcut to the following config option:

<fontInfo>
   <map from="FONT_TO_BE_RASTERED" to="CG Triumvirate_Normal_Normal" unicodeRange="U+20-U+FF"/>
</fontInfo>

Here the printer driver for Zebra printer in XTG determines which font is going to be rasterized and based on that map that font to the specified rasterSubstitutionFont present in the xdc file.

There can be multiple rasterSubstitutionFont in the XDC file for different unicodeRange just like the font substitution entry.