AEM 6.4 has reached the end of extended support and this documentation is no longer updated. For further details, see our technical support periods. Find the supported versions here.
You can optimize the delivery of PDF content and improve the Forms service’s ability to handle network load by using the client-side rendering capability of Acrobat or Adobe Reader. This process is known as rendering a form at the client. To render a form at the client, the client device (typically a web browser) must use Acrobat 7.0 or Adobe Reader 7.0 or later.
Changes to a form resulting from server-side script execution is not reflected in a form that is rendered at the client unless the root subform contains the restoreState
attribute that is set to auto
. For more information about this attribute, see Forms Designer.
For more information about the Forms service, see Services Reference for AEM Forms.
To render a form at the client, 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 client rendering run-time options
You must set the client rendering run-time option to render a form at the client by setting the RenderAtClient
run-time option to true
. This results in the form being delivered to the client device where it is rendered. If RenderAtClient
is auto
(the default value), the form design determines whether the form is rendered at the client. The form design must be a form design with a flowable layouyt.
An optional run-time option that you may set is the SeedPDF
option. The SeedPDF
option combines the PDF container (seed PDF document) with the form design and the XML data. Both the form design and the XML data are delivered to Acrobat or Adobe Reader, where the form is rendered. The SeedPDF
option can be used when the client computer does not have fonts that are used in the form, such as when an end user is not licensed to use a font that the form owner is licensed to use.
You can use Designer to create a simple dynamic PDF file for use as a seed PDF file. The following steps are required to perform this task:
You do not need to define the seed PDF run-time option to render a form on the client. If you do not specify a seed PDF, the Forms service creates a shell pdf which will not contain COS objects but will contain a PDF wrapper with the actual XDP content embedded inside. The steps in this section do not set the seed PDF run-time option. For information about COS objects, see the Adobe PDF Reference guide.
Render a form at the client
To render a form at the client, you must ensure that the client rendering run-time options are included in your application logic to render a form.
Write the form data stream to the client web browser
The Forms service creates a form data stream that you must write to the client web browser. When written to the client web browser, the form is rendered by Acrobat 7.0 or Adobe Reader 7.0 or later, and is visible to the user.
See also
Render a form at the client using the Java API
Render a form at the client using the web service API
Including AEM Forms Java library files
Forms Service API Quick Starts
Passing Documents to the Forms Service
Creating Web Applications that Renders Forms
Render a form at the client 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 client rendering run-time options
PDFFormRenderSpec
object by using its constructor.RenderAtClient
run-time option by invoking the PDFFormRenderSpec
object’s setRenderAtClient
method and passing the enum value RenderAtClient.Yes
.Render a form at the client
Invoke the FormsServiceClient
object’s renderPDFForm
method and pass the following values:
Applications/FormsApplication/1.0/FormsFolder/Loan.xdp
.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 required to render a form at the client.URLSpec
object that contains URI values that are required by the Forms service to render a form.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
com.adobe.idp.Document
object by invoking the FormsResult
object ‘s getOutputContent
method.com.adobe.idp.Document
object by invoking its getContentType
method.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.javax.servlet.ServletOutputStream
object used to write the form data stream to the client web browser by invoking the javax.servlet.http.HttpServletResponse
object’s getOutputStream
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): Rendering a form at the client using the Java API
Including AEM Forms Java library files
Render a form at the client 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 client rendering run-time options
PDFFormRenderSpec
object by using its constructor.RenderAtClient
run-time option by invoking the PDFFormRenderSpec
object’s setRenderAtClient
method and passing the string value RenderAtClient.Yes
.Render a form at the client
Invoke the FormsService
object’s renderPDFForm
method and pass the following values:
Applications/FormsApplication/1.0/FormsFolder/Loan.xdp
.BLOB
object that contains data to merge with the form. If you do not want to merge data, pass null
. (See Prepopulating Forms with Flowable Layouts.)PDFFormRenderSpec
object that stores run-time options required to render a form at the client.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 parameter 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.BLOB
object that contains form data by invoking the FormsResult
object’s getOutputContent
method.BLOB
object by invoking its getContentType
method.javax.servlet.http.HttpServletResponse
object’s content type by invoking its setContentType
method and passing the content type of the BLOB
object.javax.servlet.ServletOutputStream
object used to write the form data stream to the client web browser by invoking the javax.servlet.http.HttpServletResponse
object’s getOutputStream
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
Invoking AEM Forms using Base64 encoding