Take a survey

API Quick Starts (Code Examples) > Form Data Integration Service API Quick Starts > Quick Start: Exporting form data using the web service API

Quick Start: Exporting form data using the web service API
The following C# code example exports data from a PDF form. The form data is saved to an XML file named formData.xml.
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.IO ; 
 
namespace ConsoleApplication1
{
	class Class1
	{
		[STAThread]
		static void Main(string[] args)
		{
			try
			{
				//Create a FormDataIntegrationService object and set 
				//authentication values
				FormDataIntegrationService dataIntClient = new FormDataIntegrationService();
				dataIntClient.Credentials = new System.Net.NetworkCredential("administrator", "password");
		
				//Reference a PDF form
				BLOB inPDFForm = new BLOB();
				string path = "C:\\Adobe\\Loan.pdf";
				FileStream fsPDF = new FileStream(path, FileMode.Open);
	
				//Get the length of the file stream 
				int lenPDF = (int)fsPDF.Length; 
				byte[] bytePDF=new byte[lenPDF];
 
				//Populate the byte array with the contents of the FileStream
				fsPDF.Read(bytePDF, 0, lenPDF);
				inPDFForm.binaryData = bytePDF; 
 
				//Export data from the PDF form
				BLOB result = dataIntClient.exportData(inPDFForm);
 
				//Populate the byte array with form data located in the BLOB object
				byte[] outByteArray = result.binaryData;
 
				//Save the form data as formData.xml
				string FILE_NAME = "C:\\Adobe\\formData.xml";
				FileStream fs2 = new FileStream(FILE_NAME, FileMode.OpenOrCreate);
				BinaryWriter w = new BinaryWriter(fs2);
				w.Write(outByteArray);
				w.Close();
				fs2.Close();
			}
			catch(Exception ee)	
			{
				Console.WriteLine("An unexpected exception was encountered: "+ee.Message + "\n" + ee.StackTrace);
			}
		}
	}
}
 

 

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/quickStarts_FormDataIntegration.9.5.html