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!
![]() |
checkbox values |
Post Reply ![]() |
Author | |
toran ![]() Beginner ![]() Joined: 20 Feb 12 Status: Offline Points: 14 |
![]() ![]() ![]() ![]() ![]() 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? |
|
![]() |
|
Chumly ![]() Beginner ![]() Joined: 05 Aug 12 Status: Offline Points: 4 |
![]() ![]() ![]() ![]() ![]() |
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. :( |
|
![]() |
|
AndrewC ![]() Moderator Group ![]() ![]() Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
![]() ![]() ![]() ![]() ![]() |
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; } } |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store