Print Page | Close Window

Need Help

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=2897
Printed Date: 28 Jun 25 at 1:40PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Need Help
Posted By: oleri
Subject: Need Help
Date Posted: 16 May 14 at 7:55AM
Hi,

i need some help.

I have a PDF file with Formfields as checkbox / mutli.

I do the following:

  i := pdfl.FindFormFieldByTitle('1005');
  y := pdfl.GetFormFieldSubCount(i);

For y - i get 25 subfieldcount. How can i access this subfields?
The FormFieldType is 3. There also 25 subfields of type checkbox. I want to check one box of them.

With a other application i see that there one checkbox with name(1005) and a level below 25 others with name 1005#0, 1005#1, 1005#2 .... 1005#25.

i appreciate your help :-)



Replies:
Posted By: Ingo
Date Posted: 17 May 14 at 11:47AM
Hi Oleri,

here are three links with helpful answers for you:
http://www.quickpdf.org/forum/is-checkbox-form-field-checked-or-not_topic1774.html
http://www.quickpdf.org/forum/update-checkbox-field_topic1980.html
http://www.quickpdf.org/forum/checkbox-values_topic2559.html
here is sample code from Andrew:
http://www.quickpdf.org/forum/create-fill-checkboxes-and-radiobuttons-in-code_topic2337.html

Cheers and welcome here,
Ingo



-------------
Cheers,
Ingo



Posted By: AndrewC
Date Posted: 18 May 14 at 9:31AM
Oleri,

Here is some sample code that may help also.

            QP.LoadFromFile("formfields.pdf", "");

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

            for (int i = 1; i <= QP.FormFieldCount(); i++)
            {
                string title = QP.GetFormFieldTitle(i);
                string s = QP.GetFormFieldValue(i);
                int type = QP.GetFormFieldType(i);

                if (type == 3 || type == 4 || type == 5) // checkbox, radio, choicebox
                {
                    int sc = QP.GetFormFieldSubCount(i);
                    for (int j = 1; j <= sc; j++)
                    {
                        string sfn = QP.GetFormFieldSubName(i, j);

                        if (type == 3) 
                        {
                            if (sfn != "Off")
                              QP.SetFormFieldValueByTitle(title, sfn);
                        }
                        else
                            QP.SetFormFieldValueByTitle(title, sfn);
                    }
                }
                else if (type != 7) // Parent
                    QP.SetFormFieldValue(i, "AA BB");

                QP.UpdateAppearanceStream(i);
            }

Andrew.




Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk