Performing Service Operations Using APIs > Rendering Forms > Rendering HTML Forms Using Custom CSS Files > Rendering an HTML form that uses a CSS file using the Java API

Rendering an HTML form that uses a CSS file using the Java API
To render an HTML form that uses a custom CSS file by using the Forms 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 the HTML form that uses a custom CSS file, invoke the HTMLRenderSpec object’s setCustomCSSURI method and pass a string value that specifies the location and name of the CSS file.
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 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 used to write the form data stream to the client web browser by invoking the javax.servlet.h\ttp.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 Using Custom CSS Files > Rendering an HTML form that uses a CSS file 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.html