Performing Service Operations Using APIs > Rendering Forms > Rendering Forms By Value

Rendering Forms By Value
Typically, a form design that is created in Designer ES is passed by reference to the Forms service. Form designs can be large and, as a result, it is more efficient to pass them by reference to avoid having to marshal form design bytes by value. The Forms service can also cache the form design so that when cached, it does not have to continually read the form design.
If a form design contains a UUID attribute, then it is cached. The UUID value is unique for all form designs and is used to uniquely identify a form. When rendering a form by value, the form should only be cached when it is used repeatedly. However, if the form is not used repeatedly and has to be unique, you can avoid caching the form using caching options that are set using the LiveCycle ES API.
The Forms service can also resolve the location of linked content within the form design. For example, linked images that are referenced from within the form design are relative URLs. Linked content is always assumed to be relative to the form design location. Therefore, resolving linked content is a matter of determining its location by applying the relative path to the absolute form design location.
Instead of passing a form design by reference, you can pass a form design by value. Passing a form design by value is efficient when a form design is dynamically created; that is, when a client application generates the XML that creates a form design during run-time. In this situation a form design is not stored in a physical repository because it is stored in memory. When dynamically creating a form design at run-time and passing it by value, you can cache the form and improve performance of the Forms service.
Limitations of passing a form by value
The following limitations apply when a form design is passed by value:
Server-side calculations cannot be performed after the form is rendered. If the form is submitted back to the Forms ES service, the data is extracted and returned without any server-side calculations.
Because HTML can only use linked images at run time, it is not possible to generate HTML with embedded images. This is because the Forms ES service supports embedded images with HTML by retrieving the images from a referenced form design. Because a form design that is passed by value does not have a referenced location, embedded images cannot be extracted when the HTML page is displayed. Therefore, image references must be absolute paths to be rendered in HTML.
Note: Although you can render different types of forms by value (for example, HTML forms or forms that contain usage rights), this section discusses rendering interactive PDF forms.
Note: For more information about the Forms service, see LiveCycle ES Services.
Summary of steps
To render a form by value, perform the following steps:
1.
2.
Create a Forms Client API object.
3.
4.
5.
Include project files
Include necessary files into your development project. If you are creating a client application using Java, then include the necessary JAR files. If you are using web services, then make sure that you include the proxy files.
Create a Forms Client API object
Before you can programmatically import data into a PDF formClient API, you must create a Data Integration service client. When creating a service client, you define connection settings that are required to invoke a service.
Reference the form design
When rendering a form by value, you have to create a com.adobe.idp.Document object that contains the form design to render. You can reference an existing XDP file or you can dynamically create an form design at run-time and populate a com.adobe.idp.Document with that data.
Note: This section and the corresponding quick start references an existing XDP file.
Render a form by value
To render a form by value, pass a com.adobe.idp.Document instance that contains the form design to the render method’s inDataDoc parameter (can be any of the FormsServiceClient object’s render methods such as renderPDFForm, renderHTMLForm, and so on). This parameter value is normally reserved for data that is merged with the form. Likewise, pass an empty string value to the formQuery parameter. Normally this parameter requires a string value that specifies the name of the form design.
Note: If you want to display data within the form, the data must be specified within the xfa:datasets element. For information about XFA architecture, go to http://partners.adobe.com/public/developer/xml/index_arch.html.
Write the form data stream to the client web browser
When the Forms ES service renders a form by value, it returns a form data stream that you must write to the client web browser. When written to the client web browser, the form is visible to the user.
 
 

Performing Service Operations Using APIs > Rendering Forms > Rendering Forms By Value

Programming with LiveCycle ES (LiveDocs)
Adobe LiveCycle ES Update 1

 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/livecycle/8.2/programLC/programmer/help/000336_2.html