Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - Fill Form Field by Name - strange name
  FAQ FAQ  Forum Search   Register Register  Login Login

Fill Form Field by Name - strange name

 Post Reply Post Reply
Author
Message
Rick_Dev View Drop Down
Beginner
Beginner
Avatar

Joined: 25 Jan 12
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote Rick_Dev Quote  Post ReplyReply Direct Link To This Post Topic: Fill Form Field by Name - strange name
    Posted: 25 Jan 12 at 6:36PM
Hello,

I'm trying to fill in an IRS tax form field.  When I run through all fields in the document and get the names I see this is the field name I want to populate as returned by QuickPDFGetFormFieldTitle.
topmostSubform[0].Page1[0].Pg1Header[0].EINAndName[0].f1_02_0_[0]

I've tried calling QuickPDFSetFormFieldValueByTitle passing the entire string above and just 'f1_02_0_[0]'. Neither worked.
Can I set the "context" in some way?  I've tried doing Select Page but it didn't appear to make any difference.

Any ideas?

Thanks,
Rick
Back to Top
AndrewC View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 08 Dec 10
Location: Geelong, Aust
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote AndrewC Quote  Post ReplyReply Direct Link To This Post Posted: 26 Jan 12 at 8:16AM
FormFields with these types of names are XFA based form fields.  There are various ways to fill there but there are no guarantees as Adobe don't make this process easy.

1.  After LoadFromFile() call the following two functions and then fill the form with the standard formfield functions.

        QP.RemoveXFAEntries(0);
        QP.RemoveUsageRights();

2. Fill the form using the XFA based form field functions.

        private void XFAFillAll_Click(object sender, EventArgs e)
        {
            QP.SetNeedAppearances(1);

            int c = QP.GetXFAFormFieldCount();

            for (int i = 1; i <= c; i++)
            {
                string name = QP.GetXFAFormFieldName(i);
                string value = QP.GetXFAFormFieldValue(name);

                if (name.Contains("Button") || name.Contains("CheckBox"))
                    QP.SetXFAFormFieldValue(name, "1");
                else if (name.Contains("Date"))
                    QP.SetXFAFormFieldValue(name, "18/03/2012");
                else if (name.Contains("State"))
                    QP.SetXFAFormFieldValue(name, "AK");
                else if (name.Contains("Zip"))
                    QP.SetXFAFormFieldValue(name, "12345");
                else if (name.Contains("Amt"))
                    QP.SetXFAFormFieldValue(name, "20000000");
                else
                {
                    // Remove everything up until the last '/' character
                    int last = name.LastIndexOf('/');       
                    string s = name.Substring(last + 1);
                    
                    QP.SetXFAFormFieldValue(name, "AAA");
                }
            }
            QP.SaveToFile("out.pdf");
        }

Andrew.


Back to Top
Rick_Dev View Drop Down
Beginner
Beginner
Avatar

Joined: 25 Jan 12
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote Rick_Dev Quote  Post ReplyReply Direct Link To This Post Posted: 26 Jan 12 at 4:03PM
Thanks, Andrew.

That is interesting.  I'm currently filling out the fields using QuickPDFSetFormFieldValue and it is working for the 5-6 fields I've tested (there are 600 in the document).
I have not called RemoveXFAEntries.
I'll do some more experimenting/testing.

Thanks,
Rick
Back to Top
Rick_Dev View Drop Down
Beginner
Beginner
Avatar

Joined: 25 Jan 12
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote Rick_Dev Quote  Post ReplyReply Direct Link To This Post Posted: 30 Jan 12 at 6:53PM
Well, I have an update.

Setting the XFA field with SetFormFieldValue appeared to work but it didn't really.
When I look at the PDF file using PDF-Viewer from www.tracker-software.com everything appear fine. However, when I open it with Acrobat Reader I get an error "Expected a name object."
Bummer.

I then tried Andrew's suggestion to RemoveXFAEntries and RemoveUsageRights but then I don't get any values in my fields in the output PDF. I tried calling these methods both before and after I filled in the form values.

Any suggestions?

Thanks,
Rick
Back to Top
Rick_Dev View Drop Down
Beginner
Beginner
Avatar

Joined: 25 Jan 12
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote Rick_Dev Quote  Post ReplyReply Direct Link To This Post Posted: 30 Jan 12 at 10:51PM
Update - problem resolved.

I had a bug in my code that caused it to fail after I upgraded to version 8.xx and tried Andrew's solution.
Once I fixed the bug calling RemoveXFAEntries and RemoveUsageRights worked.
The resulting PDF looks fine in both viewers I've tested.

Thansk,
Rick
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store