Performing Service Operations Using APIs > Rendering Forms > Rendering HTML Forms with Custom Toolbars > Rendering an HTML Form with a custom toolbar using the Java API

Rendering an HTML Form with a custom toolbar using the Java API
To render an HTML Form that contains a custom toolbar by using the Forms Service API (Java), perform the following tasks:
1.
Include client JAR files, such as adobe-forms-client.jar, in your Java project’s class path. For information about the location of these files, see Including LiveCycle ES Java library files.
2.
Create a ServiceClientFactory object that contains connection properties. (See Setting connection properties.)
Create a FormsServiceClient object by using its constructor and passing the ServiceClientFactory object.
3.
Create an HTMLRenderSpec object by using its constructor.
To render an HTML form with a toolbar, invoke the HTMLRenderSpec object’s setHTMLToolbar method and pass an HTMLToolbar enum value. For example, to display a vertical HTML toolbar, pass HTMLToolbar.Vertical.
Specify the location of the fscmenu XML file by invoking the HTMLRenderSpec object’s setToolbarURI method and passing a string value that specifies the URI location of the XML file.
If applicable, set the locale value by invoking the HTMLRenderSpec object’s setLocale method and passing a string value that specifies the locale value. The default value is English.
Note: The Quick Starts that are associated with this section sets this value to fr_FR.
4.
Invoke the FormsServiceClient object’s renderHTMLForm method and pass the following values:
A TransformTo enum value that specifies the HTML preference type. For example, to render an HTML form that is compatible with dynamic HTML for Internet Explorer 5.0 or later, specify TransformTo.MSDHTML.
A com.adobe.idp.Document object that contains data to merge with the form. If you do not want to merge data, pass an empty com.adobe.idp.Document object. (See Prepopulating Dynamic Forms.)
The HTMLRenderSpec object that stores HTML run-time options.
A string value that specifies the HTTP_USER_AGENT header value, such as Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322).
A URLSpec object that stores URI values that are required to render an HTML form. (See Specify URI values.)
A java.util.HashMap object that stores file attachments. This is an optional parameter, and you can specify null if you do not want to attach files to the form. (See Attach files to the form.)
The renderHTMLForm method returns a FormsResult object that contains a form data stream that must be written to the client web browser.
5.
Create a com.adobe.idp.Document object by invoking the FormsResult object ‘s getOutputContent method.
Get the content type of the com.adobe.idp.Document object by invoking its getContentType method.
Set the javax.servlet.http.HttpServletResponse object’s content type by invoking its setContentType method and passing the content type of the com.adobe.idp.Document object.
Create a javax.servlet.ServletOutputStream object that is used to write the form data stream to the client web browser by invoking the javax.servlet.http.HttpServletResponse object’s getOutputStream method.
Create a java.io.InputStream object by invoking the com.adobe.idp.Document object’s getInputStream method.
Create a byte array and populate it with the form data stream by invoking the InputStream object’s read method and passing the byte array as an argument.
Invoke the javax.servlet.ServletOutputStream object’s write method to send the form data stream to the client web browser. Pass the byte array to the write method.
View Quick Start

Performing Service Operations Using APIs > Rendering Forms > Rendering HTML Forms with Custom Toolbars > Rendering an HTML Form with a custom toolbar using the Java API

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/000341_2.html