C#读取XFA表单数据 [英] C# to read XFA form data
问题描述
我正在尝试以编程方式从Livecycle创建的表单中读取字段值.我尝试使用Acrobat COM组件打开文档,它似乎可以正常工作,并且经过一番思考,我设法获得了实际的字段名称,但是看起来每个字段的值都很困难.
I am trying to programmatically read the field values from a Livecycle created form. I tried opening the document using the Acrobat COM component and it seemed to work and with some reflection I managed to get the actual field names, but the value for each field is the hard part, as it seems.
此外,我知道我确实需要使用其他方法来提取值,因为它是XFA格式的PDF.
Furthermore, I know believe that I actually need to use a different approach to extract the values, since it is an XFA form PDF.
(请不要告诉我查看Adobe PDF SDK中提供的示例,因为它们非常糟糕,对我的问题绝对无用-我已经阅读了Adobe文档中的所有内容).
(Please don't tell me to look into the examples provided in the Adobe PDF SDK, because they are very poor and absolutely useless to my issue - I already read all I could from the Adobe documentation).
谢谢大家.
推荐答案
在同时使用Acrobat和LiveCycle(XFA)表单时,我使用iText/iTextSharp.您需要以访问LiveCycle XML DOM为起点:
I use iText/iTextSharp when working with both Acrobat and LiveCycle (XFA) forms. You need need to get access to the LiveCycle XML DOM as the starting point:
iTextSharp示例:
iTextSharp Example:
string sourcePdf = @"c:\livecycle.pdf";<br>
PdfReader reader = new PdfReader(sourcePdf);<br>
XmlDocument xmlDoc = reader.AcroFields.Xfa.DomDocument;
您需要熟悉XFA规范才能使用DOM.
You'll need to familiarize yourself with the XFA specification to work with the DOM.
这篇关于C#读取XFA表单数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!