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.
The AEM Forms service renders interactive PDF forms to client devices, typically web browsers, to collect information from users. An interactive PDF form is based on a form design that is typically saved as an XDP file and created in Designer. As of AEM Forms, you can pass a com.adobe.idp.Document
object that contains the form design to the Forms service. The Forms service then renders the form design located in the com.adobe.idp.Document
object.
An advantage of passing a com.adobe.idp.Document
object to the Forms service is that other service operations return a com.adobe.idp.Document
instance. That is, you can get a com.adobe.idp.Document
instance from another service operation and render it. For example, assume that an XDP file is stored in a Content Services (deprecated) node named /Company Home/Form Designs
, as shown in the following illustration.
You can programmatically retrieve Loan.xdp from Content Services (deprecated) (deprecated) and pass the XDP file to the Forms service within a com.adobe.idp.Document
object.
For more information about the Forms service, see Services Reference for AEM Forms.
To pass a document obtained from Content Services (deprecated) (deprecated) to the Forms service, perform the following tasks:
Include project files
Include the necessary files in your development project. If you are creating a client application by using Java, include the necessary JAR files. If you are using web services, include the proxy files.
Create a Forms and a Document Management Client API object
Before you can programmatically perform a Forms service API operation, create a Forms Client API object. Also, because this workflow retrieves an XDP file from Content Services (deprecated), create a Document Management API object.
Retrieve the form design from Content Services (deprecated)
Retrieve the XDP file from Content Services (deprecated) by using the Java or web service API. The XDP file is returned within a com.adobe.idp.Document
instance (or a BLOB
instance if you are using web services). You can then pass the com.adobe.idp.Document
instance to the Forms service.
Render an interactive PDF form
To render an interactive form, pass the com.adobe.idp.Document
instance that was returned from Content Services (deprecated) to the Forms service.
You can pass a com.adobe.idp.Document
that contains the form design to the Forms service. Two new methods named renderPDFForm2
and renderHTMLForm2
accept a com.adobe.idp.Document
object that contains a form design.
Perform an action with the form data stream
Depending on the type of client application, you can write the form to a client web browser or save the form as a PDF file. A web-based application typically writes the form to web browser. However, a desktop application typically saves the form as a PDF file.
See also
Including AEM Forms Java library files
Forms Service API Quick Starts
Pass a document obtained from Content Services (deprecated) by using the Forms service and Content Services (deprecated) API (Java):
Include project files
Include client JAR files, such as adobe-forms-client.jar and adobe-contentservices-client.jar, in your Java project’s class path.
Create a Forms and a Document Management Client API object
ServiceClientFactory
object that contains connection properties. (See Setting connection properties.)FormsServiceClient
object by using its constructor and passing the ServiceClientFactory
object.DocumentManagementServiceClientImpl
object by using its constructor and passing the ServiceClientFactory
object.Retrieve the form design from Content Services (deprecated)
Invoke the DocumentManagementServiceClientImpl
object’s retrieveContent
method and pass the following values:
SpacesStore
. This value is a mandatory parameter./Company Home/Form Designs/Loan.xdp
). This value is a mandatory parameter.The retrieveContent
method returns a CRCResult
object that contains the XDP file. Obtain a com.adobe.idp.Document
instance by invoking the CRCResult
object’s getDocument
method.
Render an interactive PDF form
Invoke the FormsServiceClient
object’s renderPDFForm2
method and pass the following values:
com.adobe.idp.Document
object that contains the form design retrieved from Content Services (deprecated).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. This value is an optional parameter, and you can specify null
if you do not want to specify run-time options.URLSpec
object that contains URI values. This value is an optional parameter, and you can specify null
.java.util.HashMap
object that stores file attachments. This value 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.
Perform an action with the form data stream
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. Pass 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): Passing documents to the Forms Service using the Java API
Including AEM Forms Java library files
Pass a document obtained from Content Services (deprecated) by using the Forms service and Content Services (deprecated) API (web service):
Include project files
Create a Microsoft .NET project that uses MTOM. Because this client application invokes two AEM Forms services, create two service references. Use the following WSDL definition for the service reference associated with the Forms service: http://localhost:8080/soap/services/FormsService?WSDL&lc_version=9.0.1
.
Use the following WSDL definition for the service reference associated with the Document Management service: http://localhost:8080/soap/services/DocumentManagementService?WSDL&lc_version=9.0.1
.
Because the BLOB
data type is common to both service references, fully qualify the BLOB
data type when using it. In the corresponding web service quick start, all BLOB
instances are fully qualified.
Replace localhost
* with the IP address of the server hosting AEM Forms. *
Create a Forms and a Document Management Client API object
Create a FormsServiceClient
object by using its default constructor.
Create a FormsServiceClient.Endpoint.Address
object by using the System.ServiceModel.EndpointAddress
constructor. Pass a string value that specifies the WSDL to the AEM Forms service (for example, http://localhost:8080/soap/services/FormsService?WSDL
). You do not need to use the lc_version
attribute. This attribute is used when you create a service reference.)
Create a System.ServiceModel.BasicHttpBinding
object by getting the value of the FormsServiceClient.Endpoint.Binding
field. Cast the return value to BasicHttpBinding
.
Set the System.ServiceModel.BasicHttpBinding
object’s MessageEncoding
field to WSMessageEncoding.Mtom
. This value ensures that MTOM is used.
Enable basic HTTP authentication by performing the following tasks:
FormsServiceClient.ClientCredentials.UserName.UserName
.FormsServiceClient.ClientCredentials.UserName.Password
.HttpClientCredentialType.Basic
to the field BasicHttpBindingSecurity.Transport.ClientCredentialType
.Assign the constant value BasicHttpSecurityMode.TransportCredentialOnly
to the field BasicHttpBindingSecurity.Security.Mode
.
Repeat these steps for the DocumentManagementServiceClient
* service client. *
Retrieve the form design from Content Services (deprecated)
Retrieve content by invoking the DocumentManagementServiceClient
object’s retrieveContent
method and passing the following values:
SpacesStore
. This value is a mandatory parameter./Company Home/Form Designs/Loan.xdp
). This value is a mandatory parameter.BLOB
output parameter that stores the content. You can use this output parameter to retrieve the content.ServiceReference1.MyMapOf_xsd_string_To_xsd_anyType
output parameter that stores content attributes.CRCResult
output parameter. Instead of using this object, you can use the BLOB
output parameter to obtain the content.Render an interactive PDF form
Invoke the FormsServiceClient
object’s renderPDFForm2
method and pass the following values:
BLOB
object that contains the form design retrieved from Content Services (deprecated).BLOB
object that contains data to merge with the form. If you do not want to merge data, pass an empty BLOB
object.PDFFormRenderSpec
object that stores run-time options. This value is an optional parameter, and you can specify null
if you do not want to specify run-time options.URLSpec
object that contains URI values. This value is an optional parameter, and you can specify null
.Map
object that stores file attachments. This value is an optional parameter, and you can specify null
if you do not want to attach files to the form.FormsResult
output parameter that is used to store the interactrive PDF form .
The renderPDFForm2
method returns a FormsResult
object that contains the interactive PDF form.
Perform an action with the form data stream
BLOB
object that contains form data by getting the value of the FormsResult
object’s outputContent
field.System.IO.FileStream
object by invoking its constructor. Pass a string value that represents the file location of the interactive PDF document and the mode in which to open the file.BLOB
object retrieved from the FormsResult
object. Populate the byte array by getting the value of the BLOB
object’s MTOM
data member.System.IO.BinaryWriter
object by invoking its constructor and passing the System.IO.FileStream
object.System.IO.BinaryWriter
object’s Write
method and passing the byte array.See also