C# to read XFA form data

旧巷老猫 提交于 2019-12-22 10:58:13

问题


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.

Furthermore, I know believe that I actually need to use a different approach to extract the values, since it is an XFA form PDF.

(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).

Thank you all.


回答1:


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 Example:

string sourcePdf = @"c:\livecycle.pdf";<br>
PdfReader reader = new PdfReader(sourcePdf);<br>
XmlDocument xmlDoc = reader.AcroFields.Xfa.DomDocument;

You'll need to familiarize yourself with the XFA specification to work with the DOM.




回答2:


Perhaps, you could use a third-party library, such as ABCPdf to extract field values (this is not an advertisement, I used this library in a similar case, though some time ago).

Another opportunity is that if the PDF in question is under your control, you can use the HTTP-post facility of the LifeCycle-generated PDF files (AFAIK, they can send the values of the fields to a pre-configured Web address once the user pushed the Send button).



来源:https://stackoverflow.com/questions/8990235/c-sharp-to-read-xfa-form-data

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!