Summary of steps
To decode data from a PDF form, perform the following steps:
- Include project files.
- Create a barcoded formsClient API object.
- Get a PDF form that contains barcoded data.
- Decode the data from PDF form.
- Convert the data to an XML data source.
- Process the decoded data.
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:
- adobe-livecycle-client.jar
- adobe-usermanager-client.jar
- adobe-barcodedforms-client.jar
- adobe-utilities.jar (Required if AEM Forms is deployed on JBoss)
- jbossall-client.jar (Required if AEM Forms is deployed on JBoss)
- xercesImpl.jar (in <install directory>/Adobe/Adobe_Experience_Manager_forms/sdk/client-libs\thirdparty)
If AEM Forms is deployed on a supported J2EE application server that is not JBOSS, then you must replace adobe-utilities.jar and jbossall-client.jar with JAR files that are specific to the J2EE application server on which AEM Forms is deployed. For information about the location of all AEM Forms JAR files, see Including AEM Forms Java library files.
Create a barcoded forms Client API object
Before you can programmatically perform a barcoded forms service operation, you must create a Barcoded Forms service client. If you are using the Java API, create a BarcodedFormsServiceClient object. If you are using the barcoded forms web service API, create a BarcodedFormsServiceService object.
Get a PDF form that contains barcoded data
Obtain a PDF form that contains a barcode that has been populated with user data.
Decode the data from the PDF form
After you obtain a PDF form (or image) that contains a barcode, you can decode data. The Barcoded Forms service supports the following types of barcodes:
- PDF417 barcodes.
- Data matrix barcodes.
- QR code barcodes.
- Codabar barcodes.
- Code 128 barcodes.
- Code 39 barcodes.
- EAN-13 barcodes.
- EAN-8 barcodes.
Character set input as hex in the decode API implies that the content of the barcode is encoded as a hex string. For example, if UTF-8 is specified as the Character encoding in the form and Hex is specified in the decode operation, the content of the barcode is encoded as a Hex string in the < xb:content> element in the decoded output. You can convert this Hex value to get the original content by creating application logic in your client application.
Convert the data to an XML data source
After you decode form data, you can convert it to XDP or XFDF data. For example, assume that you want to import the data into another form. To import the data into an XFA form, then you have to convert the data to XDP data. For information, see Importing Form Data.
Process the decoded data
You can process the converted data to meet your business requirements. For example, after you decode and convert the data, you can save it to a file, store it in an enterprise database, populate another form, and so on. This section discusses how to save the converted data as an XML file.
Decode barcoded form data using the Java API
Decode form data by using the barcoded forms API(Java):
-
Include project files
Include client JAR files in your Java project’s class path.
-
Create a barcoded forms Client API object
Create a
BarcodedFormsServiceClientobject by using its constructor and passing aServiceClientFactoryobject that contains connection properties. -
Get a PDF form that contains barcoded data
- Create a
java.io.FileInputStreamobject that represents the PDF form that contains barcoded data by using its constructor and passing a string value that specifies the location of the PDF document. - Create a
com.adobe.idp.Documentobject by using its constructor and passing thejava.io.FileInputStreamobject.
- Create a
-
Decode the data from the PDF form
Decode the form data by invoking the
BarcodedFormsServiceClientobject’sdecodemethod and passing the following values:- The
com.adobe.idp.Documentobject that contains the PDF form. - A
java.lang.Booleanobject that specifies whether to decode a PDF417 barcode. - A
java.lang.Booleanobject that specifies whether to decode a data matrix barcode. - A
java.lang.Booleanobject that specifies whether to decode a QR code barcode. - A
java.lang.Booleanobject that specifies whether to decode a codabar barcode. - A
java.lang.Booleanobject that specifies whether to decode a code 128 barcode. - A
java.lang.Booleanobject that specifies whether to decode a code 39 barcode. - A
java.lang.Booleanobject that specifies whether to decode an EAN-13 barcode. - A
java.lang.Booleanobject that specifies whether to decode an EAN-8 barcode. - A
com.adobe.livecycle.barcodedforms.CharSetenumeration value that specifies the character set encoding value used in the barcode.
The
decodemethod returns anorg.w3c.dom.Documentobject that contains decoded form data. - The
-
Convert the data to an XML data source
Convert the decoded data into either XDP or XFDF data by invoking the
BarcodedFormsServiceClientobject’sextractToXMLmethod and passing the following values:- The
org.w3c.dom.Documentobject that contains decoded data (ensure that you use thedecodemethod’s return value). - A
com.adobe.livecycle.barcodedforms.Delimiterenumeration value that specifies the line delimiter. It is recommended that you specifyDelimiter.Carriage_Return. - A
com.adobe.livecycle.barcodedforms.Delimiterenumeration value that specifies the field delimiter. For example, specifyDelimiter.Tab. - A
com.adobe.livecycle.barcodedforms.XMLFormatenumeration value that specifies whether to convert the barcode data into XDP or XFDF XML data. For example, specifyXMLFormat.XDPto convert the data to XDP data.
NOTE
Do not specify the same values for the line delimiter and field delimiter parameters.The
extractToXMLmethod returns ajava.util.Listobject where each element is anorg.w3c.dom.Documentobject. There is a separate element for each barcode that is located on the form. That is, if there are four barcodes on the form, then there are four elements in the returnedjava.util.Listobject. - The
-
Process the decoded data
- Iterate through the
java.util.Listobject to get eachorg.w3c.dom.Documentobject that is in the list. - For each element in the list, convert the
org.w3c.dom.Documentobject to acom.adobe.idp.Documentobject. (The application logic that converts aorg.w3c.dom.Documentobject into acom.adobe.idp.Documentobject is shown in the Decoding barcoded form data using the Java API example). - Save the XML data as an XML file by invoking the
com.adobe.idp.Documentobject’scopyToFile, and passing a File object that represents the XML file.
- Iterate through the