-1

We have a VB.NET program that is using Supergoo's ABCPDF version 6.1.1.2. Our program takes standard XML strings and places values in a corresponding PDF form field on the template PDF.

Problem:

We have over 3000 PDF files that have all been "tagged" with form fields. There could be up to 50 form fields on the template PDFs for a total of roughly 150,000 form fields in use potentially. We have noticed that some of these form fields have their form field common properties set to hidden by mistake. (see screenshot)enter image description here

The issue is that the PDF coming back after the string values have been added are not showing up. Duh right? Fix the form field property and call it done. However, there is no way to know how many other of the other 150,000 form fields have been improperly tagged like this.

Does anyone know if I can adjust the PDF generation program to forcefully ignore that form field common property? Here is a sample of the vb.net code I am hoping to slightly alter...

 Dim theDoc As Doc = New Doc
 theDoc.Form.Fields("SampleFieldName").?????? 'can we set something here to ignore the hidden property?
Solo812
  • 401
  • 1
  • 8
  • 19
  • 1
    In PDF the hidden attribute is a bit in the Flags mask (/F entry in field widget dictionary). I'm not familiar with ABCpdf but maybe you can find a way to set these flags on the field. – Mihai Iancu Sep 12 '15 at 21:12
  • This was exactly what I was looking for. Thank you for your insight. In my case, ABC PDF has a SetInfo method that allows you to override the form field setting. The actual code to override this was: theDoc.SetInfo(theField.ID, "/F", "4"); – Solo812 Sep 14 '15 at 20:40

2 Answers2

0

According to the docs at http://www.websupergoo.com/helppdfnet/source/6-abcpdf.objects/field/2-properties/page.htm

The .Page property of a Field object will tell you the page the field is on. Since Page is a class, if the result 'Is Nothing' then you know that the field is not visible since it doesn't appears on any page in the PDF document.

Please note that there are a few caveats when using fields that are not hidden but not actually visible when rendered (being too small, being spread on two pages, etc). If you need need to handle that you may be interested in http://www.websupergoo.com/helppdfnet/source/6-abcpdf.objects/field/2-properties/rect.htm depending on your use cases.

Mystra007
  • 275
  • 1
  • 9
  • Thank you for your input. However, there doesn't appear to be a xxx.Form.Fields.Field() option with this version of ABCPDF. Also, I was hoping that there was a way to actually change the state of the form field to not be hidden too. – Solo812 Sep 09 '15 at 20:52
  • 1) That should be Fields.Item("name of the field"). If you don't know how to access the list of fields in a page with the product you are using then you'll to figure out how to do so with the docs I linked. As far as I am concerned I answered your question. 2) Changing the field to "not hidden" is a bit complicated because of how the PDF format work, involves adding a graphic object and linking it to a page and would probably deserve a new question. – Mystra007 Sep 09 '15 at 21:01
  • Thank you. I do know how to access the field as we have a 10,000 line program that does this already. The example you kindly posted doesn't exist as you have originally written it and the question has not been answered as of yet. Thank you anyway for your time. It sounds like you're not sure if ABCPDF is even capable of altering the PDF form field common properties to "not hidden". The docs doesn't appear to address this specific case either from what I could tell. – Solo812 Sep 09 '15 at 21:16
0

For the ABCPDF v6 software, I have discovered through Mihai's suggestion that it is possible. I have coded this C# example in the hopes that it helps someone down the road...

static void SetFillableFieldsToWriteableExample(string origFileLocation, string newFileLocation)
{
        Doc theDoc = new Doc();
        theDoc.Read(origFileLocation);
        var theFields = theDoc.Form.GetFieldNames();
        foreach (string theField in theFields)
        {
            Field theFieldInstance = theDoc.Form[theField];
            theDoc.SetInfo(theFieldInstance.ID, "/F", "4");
        }
        theDoc.Save(newFileLocation);
}

I have tested this and it works when all fields are text fields on the PDF. Not sure on the other field types.

This code should not be used in a production environment as written here. There is no guarantee that the origFileLocation or newFileLocation references a PDF and no error handling among other issues. This is for demonstration purposes only.

Solo812
  • 401
  • 1
  • 8
  • 19