using System;
using GrapeCity.Documents.Pdf;
using System.IO;

namespace Convert_pdf_form_data_to_xml
{
    class Program
    {
        static void Main(string[] args)
        {
            GcPdfDocument doc = new GcPdfDocument();

            //Create an object of filestream
            var fs = new FileStream(Path.Combine("FillForms_5.pdf"), FileMode.Open, FileAccess.Read);

            //Load the document
            doc.Load(fs);

            // Create a new memory stream
            MemoryStream stream = new MemoryStream();

            // Export form data into the stream
            doc.ExportFormDataToXML(stream);

            // Export form data directly to an XML file
            doc.ExportFormDataToXML("sampleFormData.xml");
        }
    }
}
