When rendering a form, you can set run-time options that will optimize the performance of the Forms service. Another task that you can perform to improve the performance of the Forms service is to store XDP files in the repository. However, this section does not describe how to perform this task. (See Invoking a service using a Java client library.)
For more information about the Forms service, see Services Reference for AEM Forms.
To optimize the performance of the Forms service while rendering a form, perform the following tasks:
Include project files
Include necessary files into your development project. If you are creating a client application using Java, include the necessary JAR files. If you are using web services, ensure that you include the proxy files.
Create a Forms Client API object
Before you can programmatically perform a Forms service Client API operation, you must create a Forms service client. If you are using the Java API, create a FormsServiceClient
object. If you are using the Forms web service API, create a FormsService
object.
Set performance run-time options
You can set the following performance run-time options to improve the performance of the Forms service:
true
, which results in forms being rendered without state information. State information is necessary if you want to render an interactive form to an end user who then enters information into the form and submits the form back to the Forms service. The Forms service then performs a calculation operation and renders the form back to the user with the results displayed in the form. If a form without state information is submitted back to the Forms service, only the XML data is available and server-side calculations are not performed.Render the form
To render the form after setting performance options, you use the same application logic as rendering a form without performance options.
Write the form data stream to the client web browser
After the Forms service renders a form, 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.
See also
Including AEM Forms Java library files
Forms Service API Quick Starts
Rendering Interactive PDF Forms
Creating Web Applications that Renders Forms
Render a form with optimized performance by using the Forms API (Java):
Include project files
Include client JAR files, such as adobe-forms-client.jar, in your Java project’s class path.
Create a Forms Client API object
ServiceClientFactory
object that contains connection properties.FormsServiceClient
object by using its constructor and passing the ServiceClientFactory
object.Set performance run-time options
PDFFormRenderSpec
object by using its constructor.PDFFormRenderSpec
object’s setCacheEnabled
method and passing true
.PDFFormRenderSpec
object’s setLinearizedPDF
method and passing true.
Render the form
Invoke the FormsServiceClient
object’s renderPDFForm
method and pass the following values:
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.PDFFormRenderSpec
object that stores run-time options to improve performance.URLSpec
object that contains URI values that are required by the Forms service.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.The renderPDFForm
method returns a FormsResult
object that contains a form data stream that must be written to the client web browser.
Write the form data stream to the client web browser
javax.servlet.ServletOutputStream
object used to send a form data stream to the client web browser.com.adobe.idp.Document
object by invoking the FormsResult
object ‘s getOutputContent
method.java.io.InputStream
object by invoking the com.adobe.idp.Document
object’s getInputStream
method.InputStream
object’s read
method and passing the byte array as an argument.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.See also
Quick Start (SOAP mode): Optimizing performance using the Java API
Including AEM Forms Java library files
Render a form with optimized performance by using the Forms API (web service):
Include project files
Create a Forms Client API object
Create a FormsService
object and set authentication values.
Set performance run-time options
PDFFormRenderSpec
object by using its constructor.PDFFormRenderSpec
object’s setCacheEnabled
method and passing true.PDFFormRenderSpec
object’s setStandAlone
method and passing true.PDFFormRenderSpec
object’s setLinearizedPDF
method and passing true.Render the form
Invoke the FormsService
object’s renderPDFForm
method and pass the following values:
BLOB
object that contains data to merge with the form. If you do not want to merge data, pass null
.PDFFormRenderSpecc
object that stores run-time options.URLSpec
object that contains URI values that are required by the Forms service.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.com.adobe.idp.services.holders.BLOBHolder
object that is populated by the method. This is used to store the rendered PDF form.javax.xml.rpc.holders.LongHolder
object that is populated by the method. (This argument will store the number of pages in the form).javax.xml.rpc.holders.StringHolder
object that is populated by the method. (This argument will store the locale value).com.adobe.idp.services.holders.FormsResultHolder
object that will contain the results of this operation.The renderPDFForm
method populates the com.adobe.idp.services.holders.FormsResultHolder
object that is passed as the last argument value with a form data stream that must be written to the client web browser.
Write the form data stream to the client web browser
FormResult
object by getting the value of the com.adobe.idp.services.holders.FormsResultHolder
object’s value
data member.javax.servlet.ServletOutputStream
object used to send a form data stream to the client web browser.BLOB
object that contains form data by invoking the FormsResult
object’s getOutputContent
method.BLOB
object’s getBinaryData
method. This task assigns the content of the FormsResult
object to the byte array.javax.servlet.http.HttpServletResponse
object’s write
method to send the form data stream to the client web browser. Pass the byte array to the write
method.See also