Samples and examples in this document are only for AEM Forms on JEE environment.
The Form Data Integration service can import data into a PDF form and export data from a PDF form. The import and export operations support two types of PDF forms:
Form data can exist in one of the following formats depending on the type of PDF form:
You can accomplish these tasks using the Form Data Integration service:
For more information about the Form Data Integration service, see Services Reference for AEM Forms.
You can import form data into interactive PDF forms by using the Form Data Integration service. An interactive PDF form is a PDF document that contains one or more fields for collecting information from a user or for displaying custom information. The Form Data Integration service does not support form calculations, validation, or scripting.
To import data into a form created in Designer, you must reference a valid XDP XML data source. Consider the following example mortgage application form.
To import data values into this form, you must have a valid XDP XML data source that corresponds to the form. You cannot use an arbitrary XML data source to import data into a form using the Form Data Integration service. The difference between an arbitrary XML data source and an XDP XML data source is that an XDP data source conforms to the XML Forms Architecture (XFA). The following XML represents an XDP XML data source that corresponds to the example mortgage application form.
<?xml version="1.0" encoding="UTF-8" ?>
- <xfa:datasets xmlns:xfa="https://www.xfa.org/schema/xfa-data/1.0/">
- <xfa:data>
- <data>
- <Layer>
<closeDate>1/26/2007</closeDate>
<lastName>Johnson</lastName>
<firstName>Jerry</firstName>
<mailingAddress>JJohnson@NoMailServer.com</mailingAddress>
<city>New York</city>
<zipCode>00501</zipCode>
<state>NY</state>
<dateBirth>26/08/1973</dateBirth>
<middleInitials>D</middleInitials>
<socialSecurityNumber>(555) 555-5555</socialSecurityNumber>
<phoneNumber>5555550000</phoneNumber>
</Layer>
- <Mortgage>
<mortgageAmount>295000.00</mortgageAmount>
<monthlyMortgagePayment>1724.54</monthlyMortgagePayment>
<purchasePrice>300000</purchasePrice>
<downPayment>5000</downPayment>
<term>25</term>
<interestRate>5.00</interestRate>
</Mortgage>
</data>
</xfa:data>
</xfa:datasets>
For more information about the Form Data Integration service, see Services Reference for AEM Forms.
To import form data into a PDF form, perform the following steps:
Include project files
Include necessary files into your development project. If you are creating a client application using Java, then include the necessary JAR files. If you are using web services, then make sure that you include the proxy files.
The following JAR files must be added to your project’s classpath:
For information about the location of these JAR files, see Including AEM Forms Java library files.
Create a Form Data Integration service client
Before you can programmatically import data into a PDF form Client API, you must create a Data Integration service client. When creating a service client, you define connection settings that are required to invoke a service. For information, see Setting connection properties.
Reference a PDF form
To import data into a PDF form, you must reference either an XML form created in Designer or an Acrobat form created in Acrobat.
Reference an XML data source
To import form data, you must reference a valid data source. To import data into an XFA XML form created in Designer, you must use an XDP XML data source. If you reference an Acrobat form, then you must use an XFDF data source. For each field that you want to import data into, a value must be specified. If an element in the XML data source does not correspond to a field in the form, then the element is ignored.
Import data into the PDF form
After you reference a PDF form and a valid XML data source, you can import the data into the PDF form.
Save the PDF form as a PDF file
After you import data into a form, you can save the form as a PDF file. Once saved as a PDF file, a user can open the form in Adobe Reader or Acrobat and see the form with the imported data.
See also
Import form data using the Java API
Import form data using the web service API
Including AEM Forms Java library files
Form Data Integration Service API Quick Starts
Import form data by using the Form Data Integration API (Java):
Include project files.
Include client JAR files, such as adobe-formdataintegration-client.jar, in your Java project’s class path.
Create a Form Data Integration service client.
ServiceClientFactory
object that contains connection properties.FormDataIntegrationClient
object by using its constructor and passing the ServiceClientFactory
object.Reference a PDF form.
java.io.FileInputStream
object by using its constructor. Pass a string value that specifies the location of the PDF form.com.adobe.idp.Document
object that stores the PDF form by using the com.adobe.idp.Document
constructor. Pass the java.io.FileInputStream
object that contains the PDF form to the constructor.Reference an XML data source.
java.io.FileInputStream
object by using its constructor and pass a string value that specifies the location of the XML file that contains data to import into the form.com.adobe.idp.Document
object that stores form data by using the com.adobe.idp.Document
constructor. Pass the java.io.FileInputStream
object that contains form data to the constructor.Import data into the PDF form.
Import data into PDF form by invoking the FormDataIntegrationClient
object’s importData
method and passing the following values:
com.adobe.idp.Document
object that stores the PDF form.com.adobe.idp.Document
object that stores form data.The importData
method returns a com.adobe.idp.Document
object that stores a PDF form that contains the data in the XML data source.
Save the PDF form as a PDF file.
java.io.File
object and ensure that the file extension is “.PDF”.Document
object’s copyToFile
method to copy the contents of the Document
object to the file (ensure that you use the Document
object that was returned by the importData
method).See also
Quick Start (SOAP mode): Importing form data using the Java API
Including AEM Forms Java library files
Import form data by using the Form Data Integration API (web service):
Include project files.
Create a Microsoft .NET project that uses MTOM. Ensure that you use the following WSDL definition: http://localhost:8080/soap/services/FormDataIntegration?WSDL&lc_version=9.0.1
.
Replace localhost
with the IP address of the server hosting AEM Forms.
Create a Form Data Integration service client.
Create a FormDataIntegrationClient
object by using its default constructor.
Create a FormDataIntegrationClient.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/FormDataIntegration?blob=mtom
.) You do not need to use the lc_version
attribute. This attribute is used when you create a service reference. However, specify ?blob=mtom
to use MTOM.
Create a System.ServiceModel.BasicHttpBinding
object by getting the value of the FormDataIntegrationClient.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:
FormDataIntegrationClient.ClientCredentials.UserName.UserName
.FormDataIntegrationClient.ClientCredentials.UserName.Password
.HttpClientCredentialType.Basic
to the field BasicHttpBindingSecurity.Transport.ClientCredentialType
.BasicHttpSecurityMode.TransportCredentialOnly
to the field BasicHttpBindingSecurity.Security.Mode
.Reference a PDF form.
BLOB
object by using its constructor. This BLOB
object is used to store the PDF form.System.IO.FileStream
object by invoking its constructor. Pass a string value that specifies the location of the PDF form and the mode in which to open the file.System.IO.FileStream
object. You can determine the size of the byte array by getting the System.IO.FileStream
object’s Length
property.System.IO.FileStream
object’s Read
method. Pass the byte array, the starting position, and the stream length to read.BLOB
object by assigning its MTOM
field with the contents of the byte array.Reference an XML data source.
BLOB
object by using its constructor. This BLOB
object is used to store the data that is imported into the form.System.IO.FileStream
object by invoking its constructor. Pass a string value that specifies the location of the XML file that contains data to import and the mode in which to open the file.System.IO.FileStream
object. You can determine the size of the byte array by getting the System.IO.FileStream
object’s Length
property.System.IO.FileStream
object’s Read
method. Pass the byte array, the starting position, and the stream length to read.BLOB
object by assigning its MTOM
field with the contents of the byte array.Import data into the PDF form.
Import data into the PDF form by invoking the FormDataIntegrationClient
object’s importData
method and passing the following values:
BLOB
object that stores the PDF form.BLOB
object that stores form data.The importData
method returns a BLOB
object that stores a PDF form that contains the data in the XML data source.
Save the PDF form as a PDF file.
System.IO.FileStream
object by invoking its constructor and passing a string value that represents the file location of the PDF file.BLOB
object that was returned by the importData
method. Populate the byte array by getting the value of the BLOB
object’s MTOM
field.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
You can export form data from an interactive PDF form by using the Form Data Integration service. The format of the data that is exported depends on the form type. If the form type is an Acrobat form created in Acrobat then the exported data is XFDF. If the form type is an XML form that was created in Designer, then the exported data is XDP.
For more information about the Form Data Integration service, see Services Reference for AEM Forms.
To export form data from a PDF form, perform the following steps:
Include project files
Include necessary files into your development project. If you are creating a client application using Java, then include the necessary JAR files. If you are using web services, then make sure that you include the proxy files.
The following JAR files must be added to your project’s classpath:
Create a Form Data Integration service client
Before you can programmatically import data into a PDF formClient API, you must create a Data Integration service client. When creating a service client, you define connection settings that are required to invoke a service. For information, Setting connection properties.
Reference a PDF form
To export data from a PDF form, you must reference PDF form that was created in Designer or Acrobat and that contains form data. If you attempt to export data from an empty PDF form, you will get an empty XML schema.
Export data from the PDF form
After you reference a PDF form that contains form data, you can export the data from the form. The data is exported within an XML schema that is based on the form.
Save the form data as an XML file
After you export form data, you can save the data as an XML file. Once saved as an XML file, you can open the XML file within an XML viewer to view the form data.
See also
Export form data using the Java API
Export form data using the web service API
Including AEM Forms Java library files
Form Data Integration Service API Quick Starts
Export form data by using the Form Data Integration API (Java):
Include project files.
Include client JAR files, such as adobe-formdataintegration-client.jar, in your Java project’s class path.
Create a Form Data Integration service client.
ServiceClientFactory
object that contains connection properties.FormDataIntegrationClient
object by using its constructor and passing the ServiceClientFactory
object.Reference a PDF form.
java.io.FileInputStream
object by using its constructor and pass a string value that specifies the location of the PDF form that contains data to export.com.adobe.idp.Document
object that stores the PDF form by using the com.adobe.idp.Document
constructor. Pass the java.io.FileInputStream
object that contains the PDF form to the constructor.Export data from the PDF form.
Export form data by invoking the FormDataIntegrationClient
object’s exportData
method and pass the com.adobe.idp.Document
object that stores the PDF form. This method returns a com.adobe.idp.Document
object that stores form data as an XML schema.
Save the PDF form as a PDF file.
java.io.File
object and ensure that the file extension is XML.Document
object’s copyToFile
method to copy the contents of the Document
object to the file (ensure that you use the Document
object that was returned by the exportData
method).See also
Quick Start (SOAP mode): Exporting form data using the Java API
Including AEM Forms Java library files
Export form data by using the Form Data Integration API (web service):
Include project files.
Create a Microsoft .NET project that uses MTOM. Ensure that you use the following WSDL definition: http://localhost:8080/soap/services/FormDataIntegration?WSDL&lc_version=9.0.1
.
localhost
with the IP address of the server hosting AEM Forms.Create a Form Data Integration service client.
Create a FormDataIntegrationClient
object by using its default constructor.
Create a FormDataIntegrationClient.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/FormDataIntegration?blob=mtom
.) You do not need to use the lc_version
attribute. This attribute is used when you create a service reference. However, specify ?blob=mtom
to use MTOM.
Create a System.ServiceModel.BasicHttpBinding
object by getting the value of the FormDataIntegrationClient.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:
FormDataIntegrationClient.ClientCredentials.UserName.UserName
.FormDataIntegrationClient.ClientCredentials.UserName.Password
.HttpClientCredentialType.Basic
to the field BasicHttpBindingSecurity.Transport.ClientCredentialType
.BasicHttpSecurityMode.TransportCredentialOnly
to the field BasicHttpBindingSecurity.Security.Mode
.Reference a PDF form.
BLOB
object by using its constructor. This BLOB
object is used to store the PDF form from which data is exported.System.IO.FileStream
object by invoking its constructor. Pass a string value that specifies the location of the PDF form and the mode in which to open the file.System.IO.FileStream
object. You can determine the size of the byte array by getting the System.IO.FileStream
object’s Length
property.System.IO.FileStream
object’s Read
method and passing the byte array, the starting position, and the stream length to read.BLOB
object by assigning its MTOM
field with the contents of the byte array.Export data from the PDF form.
Import data into PDF form by invoking the FormDataIntegrationClient
object’s exportData
method and pass the BLOB
object that stores the PDF form. This method returns a BLOB
object that stores form data as an XML schema.
Save the PDF form as a PDF file.
System.IO.FileStream
object by invoking its constructor and passing a string value that represents the location of the XML file.BLOB
object that was returned by the exportData
method. Populate the byte array by getting the value of the BLOB
object’s MTOM
field.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