Take a survey

Developing Applications Using APIs > Assembling PDF Documents > Programmatically Assembling PDF Documents > Assembling PDF documents using the Java API

Assembling PDF documents using the Java API
To assemble PDF documents using the Assembler service client Java API, perform the following tasks:
1.
Include client JAR files, such as adobe-assembler-client.jar, in your Java project’s class path. For information about the location of these files, see Including LiveCycle ES library files.
2.
Create a AssemblerServiceClient object by using its constructor and passing a ServiceClientFactory object that contains connection properties. For information, see Setting connection properties.
3.
Invoke the AssemblerServiceClient object’s invokeDDX method and pass the following required values:
A com.adobe.idp.Document object that represents the DDX document to be used.
A java.util.Map object that contains the PDF files to be assembled. The map object is created by using the document name as the key (for example, map.pdf) and a com.adobe.idp.Document object that contains a PDF document as the value.
A com.adobe.livecycle.assembler.client.AssemblerOptionSpec object that specifies the environment parameters, including default font and job log level.
4.
The createPDF method returns a com.adobe.livecycle.assembler.client.AssemblerResult object that contains the results of the DDX job and any exceptions that may have occurred. To obtain the newly created PDF document, perform the following actions:
Invoke the AssemblerResult object’s getDocuments method. This returns a java.util.Map object.
Iterate through the java.util.Map object until you find the resultant com.adobe.idp.Document object.
Invoke the com.adobe.idp.Document object’s copyToFile method to extract the PDF document.
The following illustration shows a sample java.util.Map object produced for a DDX document that specifies four result documents, where the job was successful. Assembler obtains the document key names from the DDX document (except for extracted file attachments and the results produced for a PDFsFromBookmarks element).
The following table summarizes some of the key values and object types that can be in the returned java.util.Map object. For more detail, see the LiveCycle ES API References.
 
Contains the result documents specified in a DDX result element
The following illustration shows a java.util.Map object produced for a job that was unsuccessful and for which EnvironmentConstants.FAIL_ON_ERROR was set to true and EnvironmentConstants.LOG_LEVEL was omitted.
If Assembler encounters an error and the FAIL_ON_ERROR environment variable is set to false, the java.util.Map object returned by the invoke method includes any result documents that were produced without errors, exception objects, and blocks of data associated with the result document for which the error occurred.
In addition to the entries illustrated above, the returned java.util.Map object may contain other entries that identify objects related to the partially completed result document. These entries are identified with the keys declared in the OutputMapConstants class. For a description of these keys, see the LiveCycle ES API References.
View Quick Start

 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/livecycle/es/sdkHelp/programmer/sdkHelp/assemblePDFEJB_API.94.3.html