Passing Documents located in Content Services (deprecated) to the Output Service

The Output service renders a non-interactive PDF form that is based on a form design that is typically saved as an XDP file and created in Designer. As of LiveCycle ES2.5, you can pass a com.adobe.idp.Document object that contains the form design to the Output service. The Output 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 Output service is that other LiveCycle 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) and pass the XDP file to the Output service within a com.adobe.idp.Document object.

Hinweis: For more information about the Forms service, see Services Reference for LiveCycle.

Summary of steps

To pass a document obtained from Content Services (deprecated) to the Output service, perform the following tasks:

  1. Include project files.

  2. Create a Output and a Document Management Client API object.

  3. Retrieve the form design from Content Services (deprecated).

  4. Render the non-interactive PDF form.

  5. Perform an action with the data stream.

Include project files

Include the necessary files to 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 an Output and a Document Management Client API object

Before you can programmatically perform a Output service API operation, create a Output 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 Output service.

Render the non-interactive PDF form

To render a non-interactive form, pass the com.adobe.idp.Document instance that was returned from Content Services (deprecated) to the Output service.

Hinweis: Two new methods named generatePDFOutput2 and generatePrintedOutput2 accept a com.adobe.idp.Document object that contains a form design. You can also pass a com.adobe.idp.Document that contains the form design to the Output service when sending a print stream to a network printer.

Perform an action with the form data stream

You can save the non-interactive form as a PDF file. The form can be viewed in Adobe Reader or Acrobat.

Pass documents to the Output Service using the Java API

Pass a document retrieved from Content Services (deprecated) by using the Output service and Content Services (deprecated) API (Java):

  1. Include project files.

    Include client JAR files, such as adobe-output-client.jar and adobe-contentservices-client.jar, in your Java project’s class path.

  2. Create an Output and a Document Management Client API object.

    • Create a ServiceClientFactory object that contains connection properties. (See Setting connection properties.)

    • Create an OutputClient object by using its constructor and passing the ServiceClientFactory object.

    • Create a DocumentManagementServiceClientImpl object by using its constructor and passing the ServiceClientFactory object.

  3. Retrieve the form design from Content Services (deprecated).

    Invoke the DocumentManagementServiceClientImpl object’s retrieveContent 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 a CRCResult object that contains the XDP file. Retrieve a com.adobe.idp.Document instance by invoking the CRCResult object’s getDocument method.

  4. Render the non-interactive PDF form.

    Invoke the OutputClient object’s generatePDFOutput2 method and pass the following values:

    • A TransformationFormat enumeration value. To generate a PDF document, specify TransformationFormat.PDF.

    • A string value that specifies the content root where the additional resources such as images are located.

    • A com.adobe.idp.Document object that represents the form design (use the instance returned by the CRCResult object’s getDocument method).

    • A PDFOutputOptionsSpec object that contains PDF run-time options.

    • A RenderOptionsSpec object that contains rendering run-time options.

    • The com.adobe.idp.Document object that contains the XML data source that contains data to merge with the form design.

    The generatePDFOutput2 method returns an OutputResult object that contains the results of the operation.

  5. Perform an action with the form data stream.

    • Retrieve a com.adobe.idp.Document object that represents the non-interactive form by invoking the OutputResult object’s getGeneratedDoc method.

    • Create a java.io.File object that contains the results of the operation. Ensure that the file name extension is .pdf.

    • Invoke the com.adobe.idp.Document object’s copyToFile method to copy the contents of the com.adobe.idp.Document object to the file (ensure that you use the com.adobe.idp.Document object that was returned by the getGeneratedDoc method).

Pass documents to the Output Service using the web service API

Pass a document retrieved from Content Services (deprecated) by using the Output service and Content Services (deprecated) API (web service):

  1. Include project files.

    Create a Microsoft .NET project that uses MTOM. Because this client application invokes two LiveCycle services, create two service references. Use the following WSDL definition for the service reference associated with the Output service: http://localhost:8080/soap/services/OutputService?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.

    Hinweis: Replace localhost with the IP address of the server hosting LiveCycle.
  2. Create an Output and a Document Management Client API object.

    • Create an OutputServiceClient object by using its default constructor.

    • Create an OutputServiceClient.Endpoint.Address object by using the System.ServiceModel.EndpointAddress constructor. Pass a string value that specifies the WSDL to the LiveCycle service (for example, http://localhost:8080/soap/services/OutputService?blob=mtom). 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 OutputServiceClient.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:

      • Assign the LiveCycle user name to the field OutputServiceClient.ClientCredentials.UserName.UserName.

      • Assign the corresponding password value to the field OutputServiceClient.ClientCredentials.UserName.Password.

      • Assign the constant value HttpClientCredentialType.Basic to the field BasicHttpBindingSecurity.Transport.ClientCredentialType.

    • Assign the constant value BasicHttpSecurityMode.TransportCredentialOnly to the field BasicHttpBindingSecurity.Security.Mode.

    Hinweis: Repeat these steps for the DocumentManagementServiceClient service client.
  3. Retrieve the form design from Content Services (deprecated).

    Retrieve content by invoking the DocumentManagementServiceClient object’s retrieveContent method and passing 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.

    • A string output parameter that stores the browse link value.

    • A BLOB output parameter that stores the content. You can use this output parameter to retrieve the content.

    • A ServiceReference1.MyMapOf_xsd_string_To_xsd_anyType output parameter that stores content attributes.

    • A CRCResult output parameter. Instead of using this object, you can use the BLOB output parameter to retrieve the content.

  4. Render the non-interactive PDF form.

    Invoke the OutputServiceClient object’s generatePDFOutput2 method and pass the following values:

    • A TransformationFormat enumeration value. To generate a PDF document, specify TransformationFormat.PDF.

    • A string value that specifies the content root where the additional resources such as images are located.

    • A BLOB object that represents the form design (use the BLOB instance returned by Content Services (deprecated)).

    • A PDFOutputOptionsSpec object that contains PDF run-time options.

    • A RenderOptionsSpec object that contains rendering run-time options.

    • The BLOB object that contains the XML data source that contains data to merge with the form design.

    • An output BLOB object that is populated by the generatePDFOutput2 method. The generatePDFOutput2 method populates this object with generated metadata that describes the document. (This parameter value is required only for web service invocation).

    • An output OutputResult object that contains the results of the operation. (This parameter value is required only for web service invocation).

    The generatePDFOutput2 method returns a BLOB object that contains the non-interactive PDF form.

  5. Perform an action with the form data stream.

    • Create a 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.

    • Create a byte array that stores the content of the BLOB object retrieved from the generatePDFOutput2 method. Populate the byte array by getting the value of the BLOB object’s MTOM data member.

    • Create a System.IO.BinaryWriter object by invoking its constructor and passing the System.IO.FileStream object.

    • Write the contents of the byte array to a PDF file by invoking the System.IO.BinaryWriter object’s Write method and passing the byte array.