Summary of steps
To pass a document obtained from Content Services (deprecated) (deprecated) to the Forms service, perform the following tasks:
- Include project files.
- Create a Forms and a Document Management Client API object.
- Retrieve the form design from Content Services (deprecated).
- Render the interactive PDF form.
- Perform an action with the form data stream.
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.
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
Pass documents to the Forms Service using the Java API
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
- Create a
ServiceClientFactory
object that contains connection properties. (See Setting connection properties.) - Create an
FormsServiceClient
object by using its constructor and passing theServiceClientFactory
object. - Create a
DocumentManagementServiceClientImpl
object by using its constructor and passing theServiceClientFactory
object.
- Create a
-
Retrieve the form design from Content Services (deprecated)
Invoke the
DocumentManagementServiceClientImpl
object’sretrieveContent
method and pass the following values:- A string value that specifies the store where the content is added. The default store is
SpacesStore
. This value is a mandatory parameter. - A string value that specifies the fully qualified path of the content to retrieve (for example,
/Company Home/Form Designs/Loan.xdp
). This value is a mandatory parameter. - A string value that specifies the version. This value is an optional parameter, and you can pass an empty string. In this situation, the latest version is retrieved.
The
retrieveContent
method returns aCRCResult
object that contains the XDP file. Obtain acom.adobe.idp.Document
instance by invoking theCRCResult
object’sgetDocument
method. - A string value that specifies the store where the content is added. The default store is
-
Render an interactive PDF form
Invoke the
FormsServiceClient
object’srenderPDFForm2
method and pass the following values:- A
com.adobe.idp.Document
object that contains the form design retrieved from Content Services (deprecated). - A
com.adobe.idp.Document
object that contains data to merge with the form. If you do not want to merge data, pass an emptycom.adobe.idp.Document
object. - A
PDFFormRenderSpec
object that stores run-time options. This value is an optional parameter, and you can specifynull
if you do not want to specify run-time options. - A
URLSpec
object that contains URI values. This value is an optional parameter, and you can specifynull
. - A
java.util.HashMap
object that stores file attachments. This value is an optional parameter, and you can specifynull
if you do not want to attach files to the form.
The
renderPDFForm
method returns aFormsResult
object that contains a form data stream that must be written to the client web browser. - A
-
Perform an action with the form data stream
- Create a
com.adobe.idp.Document
object by invoking theFormsResult
object ‘sgetOutputContent
method. - Get the content type of the
com.adobe.idp.Document
object by invoking itsgetContentType
method. - Set the
javax.servlet.http.HttpServletResponse
object’s content type by invoking itssetContentType
method and passing the content type of thecom.adobe.idp.Document
object. - Create a
javax.servlet.ServletOutputStream
object used to write the form data stream to the client web browser by invoking thejavax.servlet.http.HttpServletResponse
object’sgetOutputStream
method. - Create a
java.io.InputStream
object by invoking thecom.adobe.idp.Document
object’sgetInputStream
method. - Create a byte array and populate it with the form data stream by invoking the
InputStream
object’sread
method. Pass the byte array as an argument. - Invoke the
javax.servlet.ServletOutputStream
object’swrite
method to send the form data stream to the client web browser. Pass the byte array to thewrite
method.
- Create a