|
•
|
Create a Java DocumentBuilderFactory object by calling the DocumentBuilderFactory class’ newInstance method.
|
|
•
|
Create a Java DocumentBuilder object by calling the DocumentBuilderFactory object’s newDocumentBuilder method.
|
|
•
|
Call the DocumentBuilder object’s newDocument method to instantiate a org.w3c.dom.Document object.
|
|
•
|
Create the XML data source’s root element by invoking the org.w3c.dom.Document object’s createElement method. This creates an Element object that represents the root element. Pass a string value representing the name of the element to the createElement method. Cast the return value to Element. Next, append the root element to the document by calling the Document object’s appendChild method, and pass the root element object as an argument. The following lines of code show this application logic:
|
Element root = (Element)document.createElement("transaction");
document.appendChild(root);
|
•
|
Create the XML data source’s header element by calling the Document object’s createElement method. Pass a string value representing the name of the element to the createElement method. Cast the return value to Element. Next, append the header element to the root element by calling the root object’s appendChild method, and pass the header element object as an argument. The XML elements that are appended to the header element correspond to the static portion of the form. The following lines of code show this application logic:
|
Element header = (Element)document.createElement("header");
root.appendChild(header);
|
•
|
Create a child element that belongs to the header element by calling the Document object’s createElement method, and pass a string value that represents the element’s name. Cast the return value to Element. Next, set a value for the child element by calling its appendChild method, and pass the Document object’s createTextNode method as an argument. Specify a string value that appears as the child element’s value. Finally, append the child element to the header element by calling the header element’s appendChild method, and pass the child element object as an argument. The following lines of code shows this application logic:
|
Element poNum= (Element)document.createElement("txtPONum");
poNum.appendChild(document.createTextNode("8745236985"));
header.appendChild(LastName);
|
•
|
Create the XML data source’s detail element by calling the Document object’s createElement method. Pass a string value representing the name of the element to the createElement method. Cast the return value to Element. Next, append the detail element to the root element by calling the root object’s appendChild method, and pass the detail element object as an argument. The XML elements that are appended to the detail element correspond to the dynamic portion of the form. The following lines of code shows this application logic:
|
Element detail = (Element)document.createElement("detail");
root.appendChild(detail);
|
•
|
Create a child element that belongs to the detail element by calling the Document object’s createElement method, and pass a string value that represents the element’s name. Cast the return value to Element. Next, set a value for the child element by calling its appendChild method, and pass the Document object’s createTextNode method as an argument. Specify a string value that appears as the child element’s value. Finally, append the child element to the detail element by calling the detail element’s appendChild method, and pass the child element object as an argument. The following lines of code shows this application logic:
|
Element txtPartNum = (Element)document.createElement("txtPartNum");
txtPartNum.appendChild(document.createTextNode("00010-100"));
detail.appendChild(txtPartNum);
|
•
|
Create a javax.xml.transform.Transformer object by invoking the javax.xml.transform.Transformer object’s static newInstance method.
|
|
•
|
Create a Transformer object by invoking the TransformerFactory object’s newTransformer method.
|
|
•
|
Create a ByteArrayOutputStream object by using its constructor.
|
|
•
|
Create a javax.xml.transform.dom.DOMSource object by using its constructor and passing the org.w3c.dom.Document object that was created in step 1.
|
|
•
|
Create a javax.xml.transform.dom.DOMSource object by using its constructor and passing the ByteArrayOutputStream object.
|
|
•
|
Populate the Java ByteArrayOutputStream object by invoking the javax.xml.transform.Transformer object’s transform method and passing the javax.xml.transform.dom.DOMSource and the javax.xml.transform.stream.StreamResult objects.
|
|
•
|
Create a BLOB object by using its constructor and invoke its setBinaryData method and pass the byte array.
|
Invoke the FormsService object’s
renderPDFForm method and pass the following values:
|
•
|
A BLOB object that contains data to merge with the form. Ensure that you use the BLOB object that was created in steps one and two.
|
|
•
|
A PDFFormRenderSpecc object that stores run-time options. Note that the tagged PDF option cannot be set if the input document is a PDF document. If the input file is an XDP file, then the tagged PDF option can be set. For information about run-time options, see LiveCycle ES API References.
|
|
•
|
A URLSpec object that contains URI values that are required by the Forms service.
|
|
•
|
A 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.
|
|
•
|
An empty com.adobe.idp.services.holders.BLOBHolder object that is populated by the method. This is used to store the rendered PDF form.
|
|
•
|
An empty javax.xml.rpc.holders.LongHolder object that is populated by the method. (This argument will store the number of pages in the form).
|
|
•
|
An empty javax.xml.rpc.holders.StringHolder object that is populated by the method. (This argument will store the locale value).
|
|
•
|
An empty 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.
|
•
|
Create a FormResult object by getting the value of the com.adobe.idp.services.holders.FormsResultHolder object’s value data member.
|
|
•
|
Create a BLOB object that contains form data by invoking the FormsResult object’s getOutputContent method.
|
|
•
|
Set the javax.servlet.http.HttpServletResponse object’s content type by invoking its setContentType method and passing the content type of the BLOB object.
|
|
•
|
Create a 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.
|
|
•
|
Invoke the 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.
|
Note: 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.
Current page: http://livedocs.adobe.com/livecycle/es/sdkHelp/programmer/sdkHelp/renderingPrepopulating.40.4.html