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 - checkbox values
  FAQ FAQ  Forum Search   Register Register  Login Login

checkbox values

 Post Reply Post Reply
Author
Message
toran View Drop Down
Beginner
Beginner


Joined: 20 Feb 12
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote toran Quote  Post ReplyReply Direct Link To This Post Topic: checkbox values
    Posted: 09 Mar 13 at 1:38AM
I am processing pdf document from different origins, programmatically filling out form field values. The problem I have is filling out checkboxes.  Possible variants that I came across are "1/0", or "Off/On", or "Yes/No". 

My question is:

how to find what values makes checkbox field being "check" and "uncheck"?

There is an API function GetFormFieldDefaultValue that in case of "Off/On" will return "Off", but it is unclear if "DefaultValue" for checkbox is a value for "unchecked" or "checked" checkbox? 

Back to Top
Chumly View Drop Down
Beginner
Beginner


Joined: 05 Aug 12
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote Chumly Quote  Post ReplyReply Direct Link To This Post Posted: 28 Apr 13 at 3:26PM
Hello,
The PDF Spec seems to show that the output can be whatever the designer of the form wishes to use.
There is no set value.
You will need to either control the source pdf files, or code for each variant you find.
:(
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: 29 Apr 13 at 2:19AM
The SubNames from QPL can be used to determine the correct values.  According to the PDF specification "Off" should always be the off state.

Here is some code that attempts to turn on all Checkboxes on a form.  You can modify this code to meet your needs.

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

            for (int i = 1; i < QP.FormFieldCount(); i++)
            {
                int fType = QP.GetFormFieldType(i);
                string fName = QP.GetFormFieldTitle(i);
                int sc;

                switch (fType)
                {
                    case 1:     // Text
                        QP.SetFormFieldValue(i, "ABDCEF");
                        break;

                    case 3:
                    case 4:
                    case 5:
                        sc = QP.GetFormFieldSubCount(i);

                        for (int j = 1; j <= QP.GetFormFieldSubCount(i); j++)
                        {
                            string value = QP.GetFormFieldSubName(i, j);

                            if (value != "Off")
                                QP.SetFormFieldValue(i, value);
                        }
                        break;

                    case 7:     // Parent
                        break;
                }
            }

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