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!
Create & fill Checkboxes and Radiobuttons in code |
Post Reply |
Author | |
AndrewC
Moderator Group Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
Post Options
Thanks(0)
Posted: 17 Jul 12 at 3:29PM |
Here is some simple code to create 2 checkboxes and 2 radio buttons. The radio buttons are grouped together and the QP.SetFormFieldValue function is used to fill the field with a value. Andrew. QP.SetOrigin(1); int y = 50; QP.SetTextSize(16); QP.DrawText(50, y - 10, "Check Boxes"); int c1 = QP.NewFormField("Check1", 3); // Type = Checkbox QP.SetFormFieldBounds(c1, 50, y, 20, 20); QP.SetFormFieldCheckStyle(c1, 1, 1); // Style = Check, Centred QP.SetFormFieldValue(c1, "Off"); int c2 = QP.NewFormField("Check2", 3); QP.SetFormFieldBounds(c2, 90, y, 20, 20); QP.SetFormFieldCheckStyle(c2, 1, 1); // Style = Check, Centred QP.SetFormFieldValue(c2, "Yes"); y += 80; QP.DrawText(50, y - 10, "Radio Buttons"); int r0 = QP.NewFormField("RadioParent", 4); // Type = Radiobutton int r1 = QP.AddFormFieldSub(r0, "Radio1"); QP.SetFormFieldBounds(r1, 50, y, 20, 20); QP.SetFormFieldCheckStyle(r1, 2, 1); // Radio, Centred int r2 = QP.AddFormFieldSub(r0, "Radio2"); QP.SetFormFieldBounds(r2, 90, y, 20, 20); QP.SetFormFieldCheckStyle(r2, 2, 1); // Radio, Centred QP.SetFormFieldValue(r0, "Radio2"); QP.SaveToFile("out.pdf"); |
|
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