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
BarcodedFormsServiceClient
object by using its constructor and passing aServiceClientFactory
object that contains connection properties. -
Get a PDF form that contains barcoded data
- Create a
java.io.FileInputStream
object 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.Document
object by using its constructor and passing thejava.io.FileInputStream
object.
- Create a
-
Decode the data from the PDF form
Decode the form data by invoking the
BarcodedFormsServiceClient
object’sdecode
method and passing the following values:- The
com.adobe.idp.Document
object that contains the PDF form. - A
java.lang.Boolean
object that specifies whether to decode a PDF417 barcode. - A
java.lang.Boolean
object that specifies whether to decode a data matrix barcode. - A
java.lang.Boolean
object that specifies whether to decode a QR code barcode. - A
java.lang.Boolean
object that specifies whether to decode a codabar barcode. - A
java.lang.Boolean
object that specifies whether to decode a code 128 barcode. - A
java.lang.Boolean
object that specifies whether to decode a code 39 barcode. - A
java.lang.Boolean
object that specifies whether to decode an EAN-13 barcode. - A
java.lang.Boolean
object that specifies whether to decode an EAN-8 barcode. - A
com.adobe.livecycle.barcodedforms.CharSet
enumeration value that specifies the character set encoding value used in the barcode.
The
decode
method returns anorg.w3c.dom.Document
object 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
BarcodedFormsServiceClient
object’sextractToXML
method and passing the following values:- The
org.w3c.dom.Document
object that contains decoded data (ensure that you use thedecode
method’s return value). - A
com.adobe.livecycle.barcodedforms.Delimiter
enumeration value that specifies the line delimiter. It is recommended that you specifyDelimiter.Carriage_Return
. - A
com.adobe.livecycle.barcodedforms.Delimiter
enumeration value that specifies the field delimiter. For example, specifyDelimiter.Tab
. - A
com.adobe.livecycle.barcodedforms.XMLFormat
enumeration value that specifies whether to convert the barcode data into XDP or XFDF XML data. For example, specifyXMLFormat.XDP
to convert the data to XDP data.
NOTE
Do not specify the same values for the line delimiter and field delimiter parameters.The
extractToXML
method returns ajava.util.List
object where each element is anorg.w3c.dom.Document
object. 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.List
object. - The
-
Process the decoded data
- Iterate through the
java.util.List
object to get eachorg.w3c.dom.Document
object that is in the list. - For each element in the list, convert the
org.w3c.dom.Document
object to acom.adobe.idp.Document
object. (The application logic that converts aorg.w3c.dom.Document
object into acom.adobe.idp.Document
object 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.Document
object’scopyToFile
, and passing a File object that represents the XML file.
- Iterate through the
Decode barcoded form data using the web service API
Decode form data by using the barcoded forms API(web service):
-
Include project files
- Create a Microsoft .NET client assembly that consumes the barcoded forms service WSDL. For information, see Invoking AEM Forms using Base64 encoding.
- Reference the Microsoft .NET client assembly. For information, see “Referencing the .NET client assembly” in Invoking AEM Forms using Base64 encoding.
-
Create a barcoded forms Client API object
Using the Microsoft .NET client assembly that consumes the barcoded forms service WSDL, create an
BarcodedFormsServiceService
object by invoking its default constructor. -
Get a PDF form that contains barcoded data
- Create a
BLOB
object by using its constructor. TheBLOB
object is used to store a PDF document that contains a barcode. - Create a
System.IO.FileStream
object by invoking its constructor and passing a string value that represents the file location of the PDF document and the mode in which to open the file. - Create a byte array that stores the content of the
System.IO.FileStream
object. You can determine the size of the byte array by getting theSystem.IO.FileStream
object’sLength
property. - Populate the byte array with stream data by invoking the
System.IO.FileStream
object’sRead
method and passing the byte array, the starting position, and the stream length to read. - Populate the
BLOB
object by assigning itsbinaryData
property with the contents of the byte array.
- Create a
-
Decode the data from the PDF form
Decode the form data by invoking the
BarcodedFormsServiceService
object’sdecode
method and passing the following values:- The
BLOB
object that contains the PDF form. - A
Boolean
object that specifies whether to decode a PDF417 barcode. - A
Boolean
object that specifies whether to decode a data matrix barcode. - A
Boolean
object that specifies whether to decode a QR code barcode. - A
Boolean
object that specifies whether to decode a codabar barcode. - A
Boolean
object that specifies whether to decode a code 128 barcode. - A
Bolean
object that specifies whether to decode a code 39 barcode. - A
Boolean
object that specifies whether to decode an EAN-13 barcode. - A
Boolean
object that specifies whether to decode an EAN-8 barcode. - A
CharSet
enumeration value that specifies the character set encoding value used in the barcode.
The
decode
method returns a string value 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
BarcodedFormsServiceService
object’sextractToXML
method and passing the following values:- A string value that contains decoded data (ensure that you use the
decode
method’s return value). - A
Delimiter
enumeration value that specifies the line delimiter. It is recommended that you specifyDelimiter.Carriage_Return
. - A
Delimiter
enumeration value that specifies the field delimiter. For example, specifyDelimiter.Tab
. - A
XMLFormat
enumeration value that specifies whether to convert the barcode data into XDP or XFDF XML data. For example, specifyXMLFormat.XDP
to convert the data to XDP data.
NOTE
Do not specify the same values for the line delimiter and field delimiter parameters.The
extractToXML
method returns anObject
array where each element is anBLOB
instance. 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 returnedObject
array. - A string value that contains decoded data (ensure that you use the
-
Process the decoded data
- Create a
System.IO.FileStream
object by invoking its constructor and passing a string value that represents the file location of the secured PDF document. - Create a byte array that stores the data content of the
BLOB
object that was returned by theencryptPDFUsingPassword
method. Populate the byte array by getting the value of theBLOB
object’sbinaryData
data member. - Create a
System.IO.BinaryWriter
object by invoking its constructor and passing theSystem.IO.FileStream
object. - Write the contents of the byte array to a PDF file by invoking the
System.IO.BinaryWriter
object’sWrite
method and passing the byte array.
- Create a
Experience Manager
Espressos & Experience Manager: AEM Forms
Espressos & Experience Manager
Thursday, Mar 6, 7:00 PM UTC
Join Adobe's AEM product team as they highlight AEM Forms' latest innovations, including: the new Gen AI Assistant, Unified Composition with AEM Sites, and new ways to deploy forms through conversations.
RegisterPut the Customer at the Center and Build Relationships That Last a Lifetime
First impressions last a lifetime. Great first impressions feel personal, connected, and relevant right from the start. From the first...
Wed, Mar 19, 2:30 PM PDT (9:30 PM UTC)
The Future of Forms: Experience Success Across the Enrollment Journey
Adobe Experience Manager Forms is the conversion engine to fully capitalize on engagement and personalization efforts, yet it’s frequently...
Wed, Mar 19, 2:00 PM PDT (9:00 PM UTC)
Connect with Experience League at Summit!
Get front-row access to top sessions, hands-on activities, and networking—wherever you are!
Learn more