Pregunta

I am trying to develop a form that users can fill out and submit back to me so I can collect the data. The form will need to have 2 tables with a variable number of rows. We were using MS Word but we want to be more platform neutral. Something like a .PDF. Some users will not have an internet connection so they will need to submit it via email. I tried Adobe FormsCentral and liked their data collection feature but the form features I was using only worked in HTML and needed an internet connection.

If I use Adobe LiveCycle to create the form then I need a way to collect the data from it. I don't want to spend the $80K for Forms Pro that supposedly would allow me to collect the data. Has anybody found a product or written something to take the data (XML) from a .PDF form and put it in a SQL Server database?

Thanks, Paul

¿Fue útil?

Solución 2

C# I ended up creating a LiveCycle XFA form that submits XML data and then read this email using the following code

        XDocument xDoc = XDocument.Load(xml.FullName);


        IEnumerable<XElement> monthlyReportElements = from el in xDoc.Descendants("MonthlyReportForm") select el;

        foreach (XElement el in monthlyReportElements)
        {
            teamName = Helper.GetElement("TeamName", el, true);
            reportingDate = string.Format("{0}-{1}", Helper.GetElement("ReportingYear", el, true), Helper.GetElement("ReportingMonth", el, true));
            pdfVersion = Helper.GetElement("FileVersionField", el, true);
            supervisorEmail = Helper.GetElement("SupervisorEmail", el, true);

            return true;
        }

 internal static string GetElement(string elementName, XElement xElement, bool required)
{
    if (xElement == null
        || string.IsNullOrEmpty(elementName)
        || xElement.Element(elementName) == null
        || xElement.Element(elementName).Value == null)
    {
        if (required)
            throw new Exception(string.Format("Required element '{0}' is missing", elementName));
        else
            return string.Empty;
    }
    return xElement.Element(elementName).Value;
}

Otros consejos

You have many issues rolled into one question. I would suggest you study PDF and Adobe and learn what you can and cannot do with what you have described.

There are several types of PDF forms -- Acroforms (static), Static XFA forms and dynamic XFA forms. based on your description, you need dynamic XFA (you say variable number of rows).

You also request offline processing which means the form must be "Reader Enabled" to allow a remote user to actually save the data into the form.

So you need a tool that can create an "Adobe Reader Enabled Dynamic XFA Form" -- only Adobe Lifecycle Designer can create it but you need to read their license for how you can distribute that form to users.

As for processing a dynamic XFA Form server side to extract the data, you can look at iText. It can extract XML from PDF and you can do what you wish with that XML (parse/put in database/whatever).

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top