|
Rank: Newbie Groups: Member
Joined: 4/10/2015 Posts: 2
|
I need to check if a PDF has a form in it. I thought of just checking doc.Fields.Count but it's always zero.
Code:
var doc = new PdfDocument(@"C:\form.pdf");
var fieldCount = doc.Fields.Count; // Always 0
var field = doc.Fields["SelfEmpInc1"]; field.Value = "123"; // Null Reference Exception
What else do I have to do?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Hi, If a PDF file does have a form with fields in it, then doc.Fields.Count should not be zero. If you see Forms.Count as zero for such a file, then it's probably a bug on our side. In that case you can send us the PDF file and we will investigate further. See here for how to send test files to us: http://www.essentialobjects.com/forum/test_project.aspxThanks!
|
|
Rank: Newbie Groups: Member
Joined: 4/10/2015 Posts: 2
|
It has a form but when I load it with EO I get:
Please wait... If this message is not eventually replaced by the proper contents of the document, your PDF viewer may not be able to display this type of document.
I'll send you a file.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Hi,
I apologize for the delay. We have looked into the file you sent to us. The root of the problem is this file uses dynamic XFA form instead of the standard Adobe PDF form. XFA is a propriety format supported by Adobe LiveCycle and has very limited support beyond Adobe's own products (such as Adobe Reader). Most mainstream reader does not support this format. For example, if you open this file in Chrome browser, you will see it displays a message instead of the actual form.
Currently our product does not support this format either. We will look into this and see if we can support this format in the future. In the mean time, please use LiveCycle to resave the file in the "standard" PDF format. Then our library will be able to open it and examines the form fields.
Thanks!
|
|